25 Nov, 2019

PowerShell Notes

Поиск неиспользуемых компьютеров в AD

$searchOU = "OU=IT,OU=staff,DC=contoso,DC=com"
$lastdays = 365
$date = (get-date).AddDays(-$lastdays)
Get-ADComputer -SearchBase $searchOU -Filter {LastLogonTimeStamp -lt $date} -properties *| Select name,LastLogonDate,DistinguishedName | ConvertTo-Html | Out-File "$home\Documents\Zombies.html"

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *