47
0
AD

Active User Windows PC

47

Regular expressions to track the list of active users with Windows PC from Microsoft Active Directory.

  • Windows PowerShell
Get-ADComputer -filter {enabled -eq $true -and operatingsystem -like "*windows*" -and operatingsystem -notlike "*server*" -and name -notlike "vdi-*"} -Properties lastlogondate,operatingsystem | ? {$_.lastlogondate -ge (get-date).AddMonths(-1)}

Export:
out-gridview -title “Active User Windows PC” – Output to window
Export-Csv -NoTypeInformation -encoding UTF8 “C:\file.csv” – Output to File

Leave a Reply

Your email address will not be published.