Active Directory stores a computer object for every domain-joined machine, including servers. Each object carries the operating system name and version in the OperatingSystem and it's attributes. Querying those attributes is the standard way to enumerate servers across the domain without relying on network scans or manually maintained inventories.
With ADManager Plus, administrators can not only get all servers in a domain but also manage all the domain-joined computers from a centralized interface, making it easier to maintain an inventory of servers across the domain.
This article covers every method for listing all servers in an Active Directory domain: using PowerShell, the command line, Active Directory Users and Computers (ADUC), Active Directory Administrative Center (ADAC), and ManageEngine ADManager Plus for centralized server management.
Before running the queries below, ensure the Active Directory module is installed through RSAT on Windows 10/11 or enabled through Server Manager on Windows Server. Then run Import-Module ActiveDirectory
The Get-ADComputer cmdlet queries Active Directory for computer objects. Filtering on the OperatingSystem attribute for the string "server" returns only server operating systems, excluding workstations and other devices.
Run the following command to list all enabled servers in the domain:
Get-ADComputer -Filter {(OperatingSystem -like "*Server*") -and (Enabled -eq $true)} `
-Properties Name, OperatingSystem, OperatingSystemVersion, IPv4Address |
Sort-Object OperatingSystem |
Select-Object Name, OperatingSystem, OperatingSystemVersion, IPv4Address
This retrieves all enabled computer objects whose operating system name contains "Server", sorts the results by OS name, and displays the computer name, OS, OS version, and IP address.
To save the results to a CSV file for reporting or offline review:
Get-ADComputer -Filter {(OperatingSystem -like "*Server*") -and (Enabled -eq $true)} `
-Properties Name, OperatingSystem, OperatingSystemVersion, IPv4Address |
Sort-Object OperatingSystem |
Select-Object Name, OperatingSystem, OperatingSystemVersion, IPv4Address |
Export-Csv -Path .\DomainServers.csv -NoTypeInformation
This runs the same query and pipes the output to a CSV file named DomainServers.csv in the current directory. Open it in Excel or import it into a reporting tool.
To list only servers running a specific version, narrow the filter using the OperatingSystemVersion attribute or a more specific OS name string:
To list only Windows Server 2019 machines
Get-ADComputer -Filter {OperatingSystem -like "*Server 2019*"} `
-Properties Name, OperatingSystem, OperatingSystemVersion, IPv4Address |
Select-Object Name, OperatingSystem, OperatingSystemVersion, IPv4Address
Replace "Server 2019" with the version string that matches your environment, such as "Server 2016", "Server 2022", or "Server 2012 R2".
Use the -SearchBase parameter to restrict the query to a specific organizational unit:
Get-ADComputer -Filter {OperatingSystem -like "*Server*"} `
-SearchBase "OU=Servers,DC=contoso,DC=com" `
-Properties Name, OperatingSystem, OperatingSystemVersion, IPv4Address |
Select-Object Name, OperatingSystem, OperatingSystemVersion, IPv4Address
Replace the -SearchBase value with the distinguished name of your target OU. This is useful in large environments where servers are organized into dedicated OUs.
To get a quick breakdown of how many servers of each OS version are in the domain:
Get-ADComputer -Filter {OperatingSystem -like "*Server*"} `
-Properties OperatingSystem |
Group-Object OperatingSystem |
Sort-Object Count -Descending |
Select-Object Name, Count
This groups all server computer objects by their operating system name and returns a count for each version, sorted from most to least common.
The following essential parameters can be used while retrieving server information from Active Directory:
| Parameter | Description |
|---|---|
| -Filter | Specifies the query used to find computer objects based on conditions such as operating system and account status. |
| -SearchBase | Limits the search to a specific Active Directory organizational unit (OU) or container. |
| -Properties | Specifies additional Active Directory attributes to retrieve, such as OperatingSystem, OperatingSystemVersion, and IPv4Address. |
| -Server | Specifies the Active Directory Domain Services instance or domain controller to query. |
| -Path | Specifies the location and filename where the server list is exported when using Export-Csv. |
| -NoTypeInformation | Prevents PowerShell from adding type information to the exported CSV file. |
Active Directory Users and Computers(ADUC) does not provide a dedicated server filter, but you can use its search and filter capabilities to locate server computer objects manually.
Results can be sorted by clicking column headers. To view additional attributes such as OS version or IP address, right-click a column header and select which columns to display.
Active Directory Administrative Center (ADAC) provides a global search with attribute-level filtering that is more flexible than ADUC's Find dialog.
(&(objectCategory=computer)(operatingSystem=*Server*))
The command line does not have a dedicated tool equivalent to Get-ADComputer for listing servers by operating system. However, two approaches are available depending on what you need.
To list all computer objects in the domain using dsquery:
dsquery computer -limit 0
This returns the distinguished names of all computer objects in the domain. It does not filter by operating system, so the output includes workstations and other devices alongside servers.
To narrow results to objects in a specific OU:
dsquery computer "OU=Servers,DC=contoso,DC=com" -limit 0
This restricts the query to the specified OU. Replace the distinguished name with your target path.
To retrieve the operating system attribute for a specific computer using dsget:
dsquery computer -name SERVERNAME | dsget computer -dn -desc
Note: dsquery and dsget can confirm a machine exists in AD and retrieve basic attributes, but they do not support filtering by operating system across the whole domain the way PowerShell does. For a filtered server list, PowerShell is the correct tool.
Native Windows tools can locate server computer objects in Active Directory, but they have limitations when it comes to inventory management and reporting at scale.
Limited filtering capabilities.dsquery computer returns computer objects without providing an operating system filter, while ADUC and ADAC require additional configuration to filter by the OperatingSystem attribute. ADUC requires the Advanced tab, and ADAC requires administrators to use LDAP syntax for OS-based filtering.
No direct export or centralized reporting. ADUC and ADAC do not provide built-in options to export search results to CSV, Excel, or other structured formats. PowerShell can export results, but administrators must create and maintain scripts to generate the required reports.
No scheduling or automated report delivery. ADUC, ADAC, and dsquery are primarily on-demand tools. PowerShell scripts can be scheduled separately, but native tools do not provide built-in scheduling, recurring report generation, or automated email delivery.
Server inventory may be incomplete or inaccurate. The OperatingSystem attribute can be blank or outdated, particularly for manually created or older computer objects. Decommissioned servers may also remain in Active Directory, requiring administrators to use last logon information or other checks to identify stale objects. Additionally, the IPv4Address value returned by Get-ADComputer is resolved through DNS at query time and may not reflect the server's current IP address if DNS records are outdated.
Requires technical expertise and additional configuration. PowerShell-based reporting requires the Active Directory module, which may require RSAT installation on workstations. Advanced ADUC/ADAC filtering can also require knowledge of AD attributes or LDAP syntax. Providing narrowly scoped access to non-administrators may require additional Active Directory delegation.
No consolidated multi-domain reporting. Native tools do not provide a single interface for server inventory across multiple domains. Administrators typically need to query each domain separately and consolidate the results manually.
ADManager Plus provides a built-in OS-based computer report that lists all servers in the domain without PowerShell scripting or LDAP queries. The report reads the OperatingSystem and OperatingSystemVersion attributes directly from Active Directory and presents results in a filterable, sortable, exportable table.
Managing server inventory across Active Directory using PowerShell scripts and native tools requires scripting knowledge, manual execution, and ongoing maintenance. ADManager Plus provides pre-built computer reports that remove the need for scripting on common inventory tasks. Using ADManager Plus, you can:
Run Get-ADComputer -Filter * -Properties Name, OperatingSystem, LastLogonDate in PowerShell to return every computer object in the domain, not just servers. Add -SearchBase to scope it to a specific OU. Without PowerShell, dsquery computer -limit 0 returns all computer objects by distinguished name, though with fewer filtering options. You can also get a list of all computers in Active Directory using ADManager Plus' Computer Reports without writing scripts.
Add the -SearchBase parameter to Get-ADComputer with the distinguished name of the target OU. For example: -SearchBase "OU=Servers,DC=contoso,DC=com". This restricts the query to that OU and its child containers.
Pipe the Get-ADComputer output to Export-Csv -Path .\DomainServers.csv -NoTypeInformation. The Export to CSV section in Method 1 contains the complete command. Alternatively, ADManager Plus lets you export the server list to CSV and multiple other formats and schedule reports to be sent to your desired recipients without using PowerShell scripts.
Use the Group Policy module: Get-GPO -All | Select-Object DisplayName, GPOStatus, ModificationTime. This requires the GroupPolicy PowerShell module (installed with RSAT or on a domain controller). You can also view all GPOs through the Group Policy Management Console (GPMC) by expanding the "Group Policy Objects" container for the domain. You can also use ADManager Plus' GPO Reports to get the complete list of GPOs and manage them without writing scripts.
Remove the -Enabled $true condition from the filter, or replace it with -Enabled $false to see only disabled objects. By default, the examples above list enabled computers to exclude decommissioned machines. Alternatively, you can use ADManager Plus' Computer Reports to fetch the disabled servers.
Service Principal Names (SPNs) can be listed with the built-in setspn -Q */* command from an elevated command prompt, or in PowerShell using Get-ADUser/Get-ADComputer with the -Properties ServicePrincipalName flag. This returns all objects in the domain that have one or more SPNs registered, which is useful for finding Kerberos delegation issues or duplicate SPNs.