🎉 Our Microsoft 365 Reporting & Management Tool is now available in Azure Marketplace 🚀
This website uses cookies to improve your experience. We'll assume you're ok with this. Know more.
Active Directory

How To Get All Computers in Active Directory

A cluttered list of Active Directory computers can lead to security gaps and mismanagement. Without proper visibility, inactive and unauthorized computers may go unnoticed, which leaves your organization vulnerable to security risks . This guide provides granular methods to find computers in Active Directory and helps you maintain a well-organized and secure environment.

Get Computer List from Active Directory Using ADUC

Active Directory Permission Required
Domain Users Least Privilege
Administrators Most Privilege
  • Open the Active Directory Users and Computers (ADUC) console.
  • Click on the Action tab and select Find. In the Find drop-down , select Computer and choose the desired domain from the ‘In’ field.
  • If you want to list specific computer types like domain controllers or workstations, select the desired option from the Role drop-down.
  • Once you’ve chosen the desired options, click Find Now to get a list of all computers in Active Directory.
Get Computer List from Active Directory Using ADUC
  • Here, you can get all the computers in your Active Directory domain. You can refer to the Machine Role column to find the machine type.

Get Computer Details Using Active Directory PowerShell

Active Directory Permission Required
Domain Users Least Privilege
Administrators Most Privilege
  • Ensure that the Active Directory PowerShell module is installed on your server. If installed, run the cmdlet below to import the Active Directory module.
  • Import-Module -Name ActiveDirectory
  • Run the below cmdlet to export all computer devices in the domain via PowerShell as a CSV file.
  • Windows PowerShell Windows PowerShell
     Get-ADComputer -Filter * -Properties *| 
    Select-Object Name, Enabled, IPv4Address, OperatingSystemVersion, OperatingSystem, WhenCreated | 
    Export-Csv -Path "C:\ADComputersReport.csv" -NoTypeInformation
    export-computers-powershell
  • The above cmdlet helps you get a list of all computers in Active Directory and their key properties, such as name, status, IP address, OS version, and creation date.
  • To get all the properties of computers, you can use the cmdlet below.
  • Windows PowerShell Windows PowerShell
     Get-ADComputer -Filter * -Properties * |ft
  • To retrieve properties of a specific computer, specify the sAMAccountName of the computer in the Get-ADComputer cmdlet.
  • Windows PowerShell Windows PowerShell
     Get-ADComputer –Identity <SamAccountName>  -Properties * 

Locate All AD Computers and Clean Up Inactive Ones Seamlessly!

AdminDroid’s Active Directory reporting tool provides detailed information about all workstations, servers, and domain controllers in your environment. With its advanced reporting features, you can easily pinpoint minor changes to computer objects in Active Directory.

Mitigate DC Sync Attack in Active Directory

Identify AD computers vulnerable to DCSync attacks and revoke unnecessary replication permissions to block potential exploits.

List AD Computers with Unsupported OS Versions

Find AD computers running on unsupported OS versions and upgrade to a higher supported version for improved security settings.

Find Deleted Computer Accounts in Active Directory

Spot deleted computers in Active Directory to detect any accidental deletions and restore them if needed.

Identify the Source of Account Lockouts

Determine the source computer of account lockouts in Active Directory to identify any machines with outdated credentials that frequently cause lockouts.

Check SID History of Computers in Active Directory

View the SID history of AD computers and remove unnecessary entries to block resource access in the old domain.

Retrieve Never Logged-In Computers in Active Directory

Get a list of unused computers in Active Directory and delete them to avoid slowing down GPO and replication processing.

Overall, AdminDroid’s Active Directory management tool helps you find all computer objects in Active Directory and stay on top of AD management by:

  • Identifying inactive computers and disabling them to prevent unauthorized access.
  • Finding specific computers based on your requirements for better application of GPOs to similar computers.
  • Tracking user logins to restricted computers to check for any unauthorized logons.

Explore a full range of reporting options

Important Tips

Disable inactive AD computers to prevent security risks and optimize resource usage.

Restrict user logons to specific computers in Active Directory and prevent unauthorized access to machines with sensitive information.

Organize similar computers in an organizational unit and link a GPO for uniform settings across these computers.

Common Errors and Resolution Steps

The following are possible errors and troubleshooting hints while getting all computers in Active Directory.

Error Get-CimInstance WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet.

This error occurs when fetching user logins from computers due to an unconfigured Windows Remote Management service for remote access or missing firewall rules.

Fix Run the following cmdlet on the target machine to check if the computer is configured for remote management. If it is not enabled, the cmdlet will prompt you to enable it.
winrm quickconfig

//If remote management is enabled on the computer but the error persists, create a firewall rule to allow inbound WinRM traffic.
New-NetFirewallRule -Name "Allow WinRM" -DisplayName "Allow WinRM" -Enabled True -Direction Inbound -Action Allow -Protocol TCP -LocalPort 5985

Error Get-ADComputer : The directory service is unavailable.

This error occurs when the Active Directory web services are not running on your domain controller.

Fix Start the Active Directory web services from the services.msc console.

Error The security database on the server does not have a computer account for this workstation trust relationship.

This error occurs when you attempt to log in to a disabled computer.

Fix Run the below cmdlet to enable the computer account in Active Directory.
Set-ADComputer -Identity "<ComputerName>" -Enabled $true

Error Get-ADComputer : The term 'Get-ADComputer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

This error occurs when the Active Directory module is not installed or loaded on your machine.

Fix If you’re running the cmdlet directly from your DC, use the command below to import it since the AD module is installed by default.
Import-Module -Name ActiveDirectory
//If you’re running the cmdlet from a member server, you can run the cmdlet below to install the AD module and import it.
Install-WindowsFeature RSAT-AD-PowerShell

1. How to list all computers in an organizational unit?

You may not always need to list all computers in your domain. In some cases, you might need to manage only the computers within a specific organizational unit to focus on applying GPOs to similar computers within that OU.

View alist of computers in an OU using ADUC

  • Open the Active Directory Users and Computers snap-in .
  • Click on the Action tab and select Find
  • In the Find drop-down , select Computer, then choose the desired OU from the Browse option.
  • Hit on Find Now to display all computers in the specified OU along with their machine type.
list-computers-in-ou

Get all computers in an OU using PowerShell

The ADUC console is limited only to specific computer properties in Active Directory. To view various properties of computers, you can use PowerShell.

Run the PowerShell cmdlet below to find all computers within a specific organizational unit.

Get-ADComputer -Filter * -SearchBase "<OUDistinguishedName>" -Properties * | 
Select-Object Name, Enabled, WhenCreated, @{Name='OUName';Expression={$_.CanonicalName -replace '^.?/(.?)/[^/]+$','$1'}}| 
Format-Table

If you're unsure about the OU’s distinguished name, use the cmdlet below to retrieve it.

Get-ADOrganizationalUnit -Filter "Name -eq '<OUName>'" | 
Select-Object DistinguishedName
get-computer-in-ou-powershell

However, the above PowerShell cmdlet gets the list of computers from both the specified OU and its sub-OUs. To get computers only in the parent OU, specify the SearchScope parameter as ‘OneLevel’.

Get-ADComputer -Filter * -SearchBase "<OUDistinguishedName>" -SearchScope OneLevel -Properties * | 
Select-Object Name, Enabled, WhenCreated, @{Name='OUName';Expression={$_.CanonicalName -replace '^.?/(.?)/[^/]+$','$1'}} 
| Format-Table
get-computers-in-parent-OU

2. How to find inactive computers in Active Directory?

Inactive computers in AD, if left unnoticed, can create challenges in Active Directory management. Here are some potential issues:

  • Delays in processing GPOs that are linked to inactive computers.
  • Increase security risks, as attackers target inactive machines to access sensitive data.
  • Scripts and automation tools that generate reports for all computers may include inactive ones and create unnecessary complexity.

To prevent these issues, it is important to identify and manage stale computers in your organization. You can use the PowerShell script below to get computers that have not logged in for the past 30 days.

Note: Replace 30 with any desired timeframe based on your requirements.

#Specify the inactive days based on your requirements  
$InactiveDays = 30 
 
#Determine the threshold date for comparison  based on the inactive days    
$time = (Get-Date).Adddays(-($InactiveDays)) 
 
#Cmdlet to get inactive computers whose last logon date is beyond the threshold date 
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -Properties *|
Select-Object Name, Enabled, LastLogonDate, OperatingSystem, WhenCreated 
|Format-Table 
inactive-computers-powershell

Just specify the last logon date and let AdminDroid handle the rest!

  • Use the Active Directory inactive computers report to quickly locate computers that have been inactive for a specified number of days.
  • This report highlights key information about inactive computers, such as the computer name, status, machine type, last logon date, OS name, etc.
inactive-computers-admindroid

3. How to find which computer a user is logged into Active Directory?

Users can access shared network resources by logging into computers in Active Directory. However, unauthorized access to a computer with sensitive data can lead to data leaks.

Therefore, it is important to find who logged into a computer for managing sessions, enforcing IT policies, and maintaining network security.

You can use the PowerShell script below to list all computers and their currently logged-in users.

$Computers =  Get-ADComputer -Filter * | Select-Object -ExpandProperty Name  
$output = [System.Collections.ArrayList]::new() 
 
ForEach($Computer in $Computers) { 
  $UserName = Get-CimInstance Win32_ComputerSystem -ComputerName $Computer | 
  Select-Object -ExpandProperty UserName 
 
  $Object = New-Object -TypeName PSObject -Property @{ 
        "Computer Name" = $Computer 
        "User Logged In" = $UserName 
    } 
  $output.Add($Object) | Out-Null 
} $output 

Note: This script retrieves only users logged in via a local session. It does not capture users connected via Remote Desktop Protocol.

Track all user logins to computers in Active Directory with AdminDroid’s single centralized report.

  • The All User Logon Events report helps you to find the computer a user is logged on from and provides information on logon time, status, etc.
  • You can use the ‘Logon User Name’ easy filter to find computers where a specific user is logged in.
all-user-computer-logons

Pro Tip💡: If you want to detect any unauthorized login attempts from restricted computers, you can refer to the Logon Attempts from Restricted Computers report.

4. How to search for multiple computers in Active Directory?

In large organizations, applying GPOs to specific computers is often complex. Moving similar computers to a dedicated OU simplifies GPO management but identifying the right computers among thousands of entries presents a challenge. To simplify this process, you can search for computers based on naming conventions, operating systems, or other attributes to pinpoint the desired ones and ensure precise GPO application.

Below are some use cases that can help you search against a large list of computers.

Get all AD computers starting with a certain name

If your organization's computers follow a naming convention with department or role prefixes, use the below PowerShell cmdlet to list computers that start with a certain name.

Get-ADComputer -Filter {Name -like "WI*"} -Properties *|
Select-Object Name, IPv4Address, OperatingSystem, Enabled, WhenCreated 
|Format-Table

This will list all computers in your domain with names starting with WI.

computers-starting-with-specific-name

Find all computers with a specific operating system

When planning an OS upgrade or identifying outdated systems for decommissioning, it is crucial to pinpoint computers running a specific operating system in Active Directory. Use the cmdlet below to find all machines running a particular OS version.

Get-ADComputer -Filter "OperatingSystem -like 'Windows 11*'" -Properties *|
Select-Object Name, IPv4Address, OperatingSystem, Enabled, WhenCreated 
|Format-Table

The above cmdlet retrieves computers running Windows 11 in your Active Directory domain.

computer-specific-OS

List all client computer objects in Active Directory

Imagine a scenario where you need to list only the client workstations in Active Directory. Since the computer list includes all machines (member servers and domain controllers), you can use the cmdlet below to retrieve only the workstations.

Get-ADComputer -Filter "OperatingSystem -notlike '*server*'" -Properties * |
Select-Object Name, IPv4Address, OperatingSystem, Enabled, WhenCreated 
|Format-Table
get-all-client-computers

Search for multiple computers in a single report without complex navigation!

You can use AdminDroid’s rich filtering functionality to retrieve the computer list based on your requirements.

  • Computer Name prefixes to find machines following specific naming conventions.
  • Machine Type, such as domain controllers, workstations, or member servers.
  • Computer Status, whether enabled or disabled.
search-for-multiple-computers

Kickstart Your Journey With
AdminDroid

Your Microsoft 365 Companion with Enormous Reporting Capabilities

Download Now
User Help Manuals Compliance Docs
x
Delivering Reports on Time
Want a desired Microsoft 365 reports every Monday morning? Ensure automated report distribution and timely delivery with AdminDroid's Scheduling to your email anytime you need.
Delivering Reports on Time
Schedule tailored reports to execute automatically at the time you set and deliver straight to the emails you choose. In addition, you can customize report columns and add inteligent filtering to the activities just from the previous day to suit your Microsoft 365 report requirements.
Set It, Schedule It, See Results- Your Reports, Your Way, On Your Time!
Time Saving
Automation
Customization
Intelligent Filtering
Give Just the Right Access to the Right People
Grant fine-tuned access to any Microsoft 365 user with AdminDroid’s Granular Delegation and meet your organization’s security and compliance requirements.
Give Just the Right Access to the Right People
Create custom roles loaded with just the right permissions and give access to admins or normal users within AdminDroid. The result? A streamlined Microsoft 365 management experience that aligns your organization's security protocols and saves your invaluable time and effort.
Align, Define, Simplify: AdminDroid's Granular Delegation
Smart Organizational Control
Effortless M365 Management
Simplified Access
Advanced Alerts at a Glance
Receive quick notifications for malicious Microsoft 365 activities. Engage with the AdminDroid’s real-time alert policies crafted to streamline your security investigations.
Advanced Alerts at a Glance
Stay informed of critical activities like suspicious emails and high-risk logins, bulk file sharing, etc. Through creating and validating ideal alert policies, AdminDroid provides a comprehensive approach to real-time monitoring and management of potential threats within your organization.
AdminDroid Keeps You Always Vigilant, Never Vulnerable!
Proactive Protection
Real-time Monitoring
Security Intelligence
Threat Detection
Merge the Required Data to One Place
Combine multiple required columns into one comprehensive report and prioritize the information that matters most to you with AdminDroid’s Advanced Column Customization.
Merge the Required Data to One Place
This column merging capability offers a flexible way to add different columns from various reports and collate all the essential data in one place. Want to revisit the customized report? Save it as a 'View’, and your unique report is ready whenever you need it.
Merge with Ease and Save as Views!
Custom Reporting
Unique View
Desired Columns
Easy Data Interpretation
Insightful Charts and Exclusive Dashboards
Get a quick and easy overview of your tenant's activity, identify potential problems, and take action to protect your data with AdminDroid’s Charts and Dashboards.
Insightful Charts and Exclusive Dashboards
With AdminDroid charts and dashboards, visualize your Microsoft 365 tenant in ways you've never thought possible. It's not just about viewing; it's about understanding, controlling, and transforming your Microsoft 365 environment.
Explore Your Microsoft 365 Tenant in a Whole New Way!
Executive overviews
Interactive insights
Decision-making
Data Visualization
Efficient Report Exporting for Microsoft 365
Downloading your reports in the right file format shouldn’t be a hassle with AdminDroid’s Report Export. Experience seamless report exporting in various formats that cater to your needs.
Efficient Report Exporting for Microsoft 365
Navigate through diverse options and export Microsoft 365 reports flawlessly in your desired file format. Tailor your reports precisely as you need them and save them directly to your computer.
Take Control, Customize and Deliver- Your Office 365 Data, Exported in Your Way!
Easy Export
Seamless Downloading
Data Control
Manage Microsoft 365

Get AdminDroid Office 365 Reporter Now!