
Find Windows 7 Computer Objects in Active Directory with PowerShell
With the end of support for Windows 7 coming up in about a year, it is time once again to check your company network for legacy systems.
1 min read
What else to keep in mind until the end of support in January 2020 is summarized by heise.de in this article (in German).
Get-ADComputer PowerShell
A simple PowerShell one-liner can list all computer objects running Windows 7.
Import-Module ActiveDirectory
Get-ADComputer -Filter {operatingSystem -eq "Windows 7 *" -and enabled -eq $true}
With -Filter you can of course narrow down the objects by other criteria as well. With -LDAPFilter and -SearchBase, the search is limited to individual OUs or to objects named according to a certain pattern:
Get-ADComputer -LDAPFilter "(name=*laptop*)" -SearchBase "CN=Computers,DC=mydomain,DC=com"