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 windowExport-Csv -NoTypeInformation -encoding UTF8 “C:\file.csv”
– Output to File