Skip to main content
AD Academy
Back to all recipes
Level: JuniorLast updated:

List all computers by operating system

Get-ADComputer -Filter * -Properties OperatingSystem,OperatingSystemVersion,LastLogonDate |
  Group-Object OperatingSystem | Sort-Object Count -Descending |
  Select-Object Count,Name

Why it works this way

The first question in any upgrade project or after a new CVE: how many old machines remain, and where.

Watch out

  • Read-only — safe to run any time.
  • Append | Export-Csv to send the report to your manager.

Similar recipes