Search Tools Links Login

Find Active Directory Computers by OS


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.

About this post

Posted: 2022-07-28
By: dwirch
Viewed: 147 times

Categories

Active Directory

Scripting

Powershell

PowerShell Code Cache

Attachments

No attachments for this post

Requirements

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


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.