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"

http://admin-to-admin.info/blog/poisk-neispolzuemyih-kompyuterov-v-ad/

Переименовать каталог
$curDateTime = Get-Date -Format dd.MM.yy ; Rename-Item “C:\ProgramData\Medoc\MedocSRV\incoming” incoming$curDateTime

You may also like...

Leave a Reply

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