Managing and maintaining a Windows-based IT infrastructure calls for tools that provide efficiency, reliability, and detailed control over a wide range of system components. One of the most powerful tools for Windows administrators is PowerShell, and within this repertoire lies a particularly useful cmdlet: Get-ADComputer. This cmdlet allows system administrators to query Active Directory (AD) for information about computers in an environment, returning data that can inform troubleshooting, auditing, and compliance tasks.
Get-ADComputer is a member of the Active Directory module for Windows PowerShell. With it, administrators can filter, extract, and manipulate computer object data from AD without needing to manually navigate complex user interfaces or rely on third-party utilities. Understanding how to use Get-ADComputer effectively is essential for any IT professional working in a domain-joined environment.
What Is Get-ADComputer?
The Get-ADComputer cmdlet retrieves information about one or more computer accounts from Active Directory. It can be used with various parameters to refine your search or return additional properties not shown by default. This cmdlet is part of the Active Directory PowerShell module, which must be installed and imported before use.
To use it, your system should be running Windows Server or have the Remote Server Administration Tools (RSAT) installed on a compatible Windows version.
Basic Usage
The simplest usage of Get-ADComputer is to retrieve a list of all computer objects in AD:
Get-ADComputer -Filter *
This command returns basic information such as the name and distinguished name (DN) of all computer accounts in Active Directory. However, by default, it does not return extended properties.

Extracting Specific Information
To gather more useful information from computer objects, use the -Property parameter. For example:
Get-ADComputer -Filter * -Property Name,OperatingSystem,LastLogonDate
This command retrieves the name, operating system, and last logon date of all computers in AD—information that’s extremely useful for asset management or identifying unused machines.
Commonly Requested Computer Properties:
- Name – The hostname of the computer
- OperatingSystem – Windows version information
- LastLogonDate – Indicates when the computer last authenticated
- IPv4Address – IP address if recorded in AD
- DistinguishedName – Full LDAP path of the object
Filtering for Relevance
To avoid wading through an overwhelming dataset, Get-ADComputer supports filters. For instance:
Get-ADComputer -Filter 'OperatingSystem -like "Windows 10*"' -Property Name, OperatingSystem
This command filters out only computers running Windows 10, great for segmenting machines by OS version.
Exporting Results
To integrate AD computer data into reports or external tools, you can export the results to a CSV file:
Get-ADComputer -Filter * -Property Name, OperatingSystem | Select-Object Name, OperatingSystem | Export-Csv -Path "C:\computer_inventory.csv" -NoTypeInformation
This approach simplifies data sharing between departments or archiving snapshots of your current infrastructure.

Security and Permissions
It is important to note that using Get-ADComputer requires that the user have appropriate privileges to query Active Directory. In most cases, standard domain users can run basic queries, but accessing sensitive properties or large sets of accounts may require elevated permissions.
Advanced Query Examples
Finding Inactive Computers
Get-ADComputer -Filter {LastLogonDate -lt (Get-Date).AddDays(-90)} -Property Name, LastLogonDate
This command identifies machines that haven’t connected to the network in over 90 days—a helpful way to flag decommissioned or unused systems.
Querying by Organizational Unit (OU)
Get-ADComputer -SearchBase "OU=Workstations,DC=Contoso,DC=com" -Filter * -Property Name
Here, only computer objects located in the specified OU are returned, ideal for departmental audits or site-specific troubleshooting.
Final Thoughts
The Get-ADComputer cmdlet is a versatile and essential tool for Active Directory administration. It provides fast, scriptable access to detailed information about every computer on your domain. By mastering its capabilities, administrators can improve operational visibility, automate reporting tasks, and proactively manage endpoints within their infrastructure.
Whether you’re detecting inactive systems, preparing migration plans, or auditing OS versions across the enterprise, Get-ADComputer is a reliable cornerstone in any scripting toolkit.