Skip to content

Instantly share code, notes, and snippets.

@zaskem
zaskem / QueryMachines.ps1
Created January 12, 2020 19:09
Query Workstations in AD by Name Prefix
Get-ADComputer -Filter 'Name -like "MNS*"' -Property * | Select-Object Name, Description, DistinguishedName, OperatingSystem, OperatingSystemVersion, @{n='LastLogonTimeStamp';e={[DateTime]::FromFileTime($_.LastLogonTimeStamp)}}, WhenCreated, IPv4Address | Export-CSV .\WorkstationsLikeMNS.csv -NoTypeInformation -Encoding UTF8