

Select-Object -Property Name,Operatingsystem,OperatingSystemVersion,IPv4Address | Then Out-File or ConvertTo-HTML can help. Or you want to save the output to a file. Get-ADComputer -Filter 'enabled -eq "true"' `įor a nicer view you can add Out-Gridview at the end. Last but not least, we retrieve all domain-computers by running the following code. Retrieve all Computer sorted by Operatingsystem Get-ADComputer -Filter 'operatingsystem -like "*server*" -and enabled -eq "true" -and primarygroupid -ne "516"' ` To retrieve all servers that are not Domain-Controllers, run the following code. Get-ADComputer -Filter 'primarygroupid -eq "516"' ` All Domain-Controllers are member of the group Domain-Controllers, which ID is 516. To display all Domain-Controllers I decided to target on the computer account group membership. Retrieve all Domain-Controllers (no Member-Server)

Get-ADComputer -Filter 'operatingsystem -notlike "*server*" -and enabled -eq "true"' `
#LIST ALL MAC OPERATING SYSTEMS CODE#
Therefore we simply change the code above and set the operating system query to -notlike server.
#LIST ALL MAC OPERATING SYSTEMS WINDOWS#
Windows Client computer doesn’t have the term server in its operating system attribute. Select-Object -Property Name,Operatingsystem,OperatingSystemVersion,IPv4Address Properties Name,Operatingsystem,OperatingSystemVersion,IPv4Address | Get-ADComputer -Filter 'operatingsystem -like "*server*" -and enabled -eq "true"' ` To retrieve all enabled Windows Servers sorted by operatingsystem, we need to target the operating system attribute. If you want to join in, open PowerShell (powershell.exe) or PowerShell ISE (ise.exe). Finally I will query all domain-computers and sort them by operating system. I will successively retrieve all enabled Windows Servers, Windows Clients and Domain-Controllers and display them separately. In this blog post I will carry out some PowerShell commands to get a list of domain-computers filtered by operating system. Of course, this also includes user and computer accounts. As an administrator, you should have an overview of your Active Directory environment.
