Skip to content

Instantly share code, notes, and snippets.

@zaskem
Created January 12, 2020 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaskem/d99dcabf07e8db8f34e4d012a3b13c43 to your computer and use it in GitHub Desktop.
Save zaskem/d99dcabf07e8db8f34e4d012a3b13c43 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment