Find Active Directory Computers by OS

By | 2022-07-28

Finding machines in Active Directory is pretty easy using the Get-ADComputer commandlet.

You can specify what to find by any number of parameters. For example, the most basic use of the commandlet is:

Get-ADComputer -Filter *

The above code will return all Active Directory computer objects. But lets say you are in the process of upgrading operating systems across the domain, and you think you are done. But to make sure, you need to see if there are any stragglers. So, crack open your PowerShell prompt, and use Get-ADComputer. The syntax is as follows:

Get-ADComputer -filter 'OperatingSystem -like "Windows 2016*"'

Note the use of the asterisk (*) at the end of the operating system designation. This means that you are only matching the first part of the OperatingSystem string, and don’t care what comes after it. The above command will get you a list of all domain-joined computers that contain “Windows 2016”.

Adjust the name portion as appropriate.

Requirements

The Active Directory PowerShell module is required to make use of Get-ADComputer.

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.