Rāda ziņas ar etiķeti ActiveDirectory. Rādīt visas ziņas
Rāda ziņas ar etiķeti ActiveDirectory. Rādīt visas ziņas

ceturtdiena, 2013. gada 14. marts

Powershell script ps1 to show inactive computer accounts in AD Active Directory


Today I needed a script to show inactive computers in Active Directory 2008, I found PowerShell script, but it shows active users so I changed filter from gt- greater that to lt- less than.


Import-Module ActiveDirectory

$today = Get-Date

$cutoffdate = $today.AddDays(-60)


Get-ADComputer  -Properties * -Filter {modifyTimeStamp -lt $cutoffdate} `
| Select Name,OperatingSystem,modifyTimeStamp,CanonicalName | Export-Csv C:\Users\Admgiors\Desktop\ActiveComputers.csv



Sory to say Anand  was wrong I dont know what MS people smoke but LastLoginDate shows First Login time.
Modified means computer password was changed. Computer account password expires in  2 months.