🎉 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 Find Inactive Computers in Active Directory

Active Directory offers strong computer management, from enforcing security settings to system configurations. However, a large number of computers in an organization can be difficult to manage, especially when dealing with inactive computer accounts. These accounts not only clutter the directory’s hierarchy but can also pose security risks if left unchecked. This guide will show you how to identify and manage inactive Active Directory computers efficiently.

Track a Computer’s Last Logon in AD Using Active Directory Users and Computers

Active Directory Permission Required
Account Operators Least Privilege
Administrators Most Privilege
  • Open the Active Directory Users and Computers console.
  • Ensure the View»Advanced Features option is enabled. Then, right-click the respective computer and select Properties.
  • Go to the Attribute Editor tab, scroll down, and find the LastLogonTimeStamp attribute to check the computer's last active session in AD.
Track a Computer’s Last Logon in AD Using Active Directory Users and Computers

Short Note: ADUC does not have a direct option to filter computers based on inactivity. You must manually calculate inactive days using the last logon time.

Get Inactive AD computers using PowerShell

Active Directory Permission Required
Account Operators Least Privilege
Global Admin Most Privilege
  • Use the following cmdlet to import the Active Directory PowerShell module.
  • Windows PowerShell Windows PowerShell
     Import-Module ActiveDirectory
  • Run the below cmdlet to find the list of inactive computers for the desired inactivity period.
  • Replace <RequiredDays> with number of inactivity days to identify the inactive computers for the specified duration.
  • Windows PowerShell Windows PowerShell
     $InactiveDays = <RequiredDays> 
     $CutoffDate = (Get-Date).AddDays(-$InactiveDays) 
     Get-ADComputer -Filter * -Properties LastLogonDate | Where-Object { $.LastLogonDate -lt $CutoffDate -and $.LastLogonDate -ne $null } | 
      Select-Object Name, LastLogonDate, Enabled, DistinguishedName
Get Inactive AD computers using PowerShell

Prevent Stale Computers from Becoming Security Loopholes with AdminDroid

AdminDroid’s Active Directory reporting tool simplifies the management of inactive computers with an intuitive interface for admins. It helps to identify unused computers consuming licenses and allows admins to reclaim resources. With valuable insights , the tool ensures efficient handling of unused computers and helps to secure the AD environment.

Stay Notified When Critical Computers are Disabled

Receive instant alerts for disabled computer events in Active Directory to quickly detect unauthorized actions and re-enable the computer to prevent downtime.

Automate and Validate Deleted Computers in Active Directory

Schedule the deleted computers report periodically to detect unauthorized deletions and prevent potential service disruptions in Active Directory.

Ensure BitLocker Protection Across AD Computers

Track the BitLocker disabled computers in your organization and enable BitLocker to add an additional security layer on AD computers.

Review and Manage Delegation on Inactive AD Computers

Verify inactive computers trusted for delegation and revoke those rights to prevent use of outdated Kerberos tickets or cached credentials for unauthorized authentication.

Add Managers to Unmanaged Computers for Better Tracking

Assign managers to all unmanaged computers in Active Directory to keep track of ownership, ensure accountability, and maintain an organized AD environment.

Examine Comprehensive AD Computer Analytics

Utilize AdminDroid’s computer dashboard to track inactive AD computers, check their status and login permissions, and streamline resource management.

In conclusion, AdminDroid helps to find all inactive computers in AD and ensures accurate asset tracking in AD . It enables admins to detect outdated devices and clean them to maintain an efficient AD environment.

Explore a full range of reporting options

Important Tips

Ensure the inactive AD computers are not running essential services like DNS, DHCP, or print services before removal to avoid any network failures or service disruptions.

Understand the limitations and types of last logon attributes to make informed decisions on managing inactive AD computers.

Detect never logged in computers and allocate them to the required users for efficient Active Directory resource management.

Common Errors and Resolution Steps

The following are possible errors and troubleshooting hints while finding inactive AD computers.

Error Computer is not showing up in active directory

This error occurs when only the ‘Users’ object type is selected under the ‘Set Filtering Conditions’.

Fix Make sure to select the ‘Show all type of objects’ option under the ‘Set Filtering Conditions’ to view all objects in your ADUC hierarchy.

Error You do not have sufficient privileges to delete , or this object is protected from accidental deletion.

This error occurs when you try to delete the computer from the ADUC console with the "Protect object from accidental deletion" setting enabled.

Fix To fix this issue, uncheck the "Protect object from accidental deletion" option in the Object tab of the computer's properties before deleting the computer.

Error Import-Module : The specified module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory.

This PowerShell error occurs on a domain-joined computer when attempting to import the Active Directory module.

Fix
  • If you're using a domain-joined computer (not a domain controller), you need to manually install the Active Directory module using RSAT.
  • You can install it quickly using PowerShell.
  • Once installed, import the module with the below cmdlet.
//Use the following cmdlet to install RSAT.
Add-WindowsCapability -Online -Name "Rsat.ActiveDirectory.DS - LDS.Tools~~~~0.0.1.0"
//To import the Active Directory.
Import-Module ActiveDirectory

1. What is the difference between inactive and disabled computers in Active Directory?

Admins often struggle to manage organizational resources effectively due to unused computers. These computers may be inactive due to low usage or temporarily disabled during employee offboarding or transfers. To manage these devices wisely, it’s important to differentiate them as inactive and disabled computers. Misjudging them could result in unnecessary deletions and service disruptions.

Here’s a clear difference between the two to help decide their relevance and take appropriate actions .

diff-inactive-and-disabled-computers-ad

2. How to disable inactive computers in Active Directory?

In Active Directory, computers act as resource hubs that store sensitive and critical organizational data. When these computers remain inactive for extended periods, they create both security risks and unnecessary resource consumption . Therefore, properly managing these computers is essential to optimize resource usage and management overhead.

When it comes to managing inactive Active Directory computers, disabling them serves as the first layer of defense against potential security risks, such as device compromise or unauthorized actions by former employees. By proactively disabling these accounts, you can prevent misuse and secure your Active Directory environment from vulnerabilities.

Let’s dive into the steps to effectively disable inactive computers in Active Directory.

Deactivate inactive computers in Active Directory

  • Open ADUC and right- click the inactive computer.
  • Choose Disable Account from the context menu.
  • Click Yes in the warning dialog box to disable the selected computer in Active Directory.
disable-inactive-computers-aduc

Disable inactive Active Directory computer accounts using PowerShell

Utilize the below PowerShell cmdlet to disable an inactive computer in your Active Directory environment.

Set-ADComputer -Identity <ComputerName>  -Enabled $false

Note: Replace the <ComputerName> with the sAMAccountName of the targeted computer before running the cmdlet.

Simplify your workflow with AdminDroid's reports that combine insights and management actions in one place!

  • All Active Directory Computers report: Monitor and manage computers across all organizational units of a domain in a centralized, single report.
  • Quick Actions: Select any inactive computer from the list, click More Action, and choose Disable Computer to complete the task effortlessly.
manage-disable-computer

Pro Tip: You can select multiple computers and disable them all at once, no need for complex PowerShell scripts or time-consuming native solutions.

3. How to remove inactive computers from Active Directory?

Once inactive computers are disabled and approved for deletion, the next step is to remove them from Active Directory. This process reduces security risks and improves management efficiency. It also offers benefits such as resource management, smoother migrations, etc.

For instance, during migration, excess inactive resource accounts can lead to additional costs and time-consuming processes. By removing the inactive computers, we can ensure that only active AD computers are migrated into the new AD environment.

Clean up inactive AD computer objects in ADUC

Follow the steps below to remove the inactive computers from your Active Directory environment:

  • Launch the Active Directory Users and Computers console.
  • Navigate to the respective OU where the computer is located and right-click on the respective computer.
  • Click on Delete to initiate the removal. Then, select ‘Yes’ in the confirmation window to delete the computer from Active Directory.
remove-ad-computer

Remove stale computers from Active Directory using PowerShell

Manually navigating through multiple OUs to locate and delete inactive computers can be a tedious and time-consuming process. Instead, you can use their identity in the following PowerShell cmdlet to remove them from Active Directory.

Remove-ADComputer -Identity "<ComputerName>"
remove-ad-computer-powershell

Remove multiple computers in bulk

Use the below PowerShell script to remove multiple AD computer accounts quickly to avoid unnecessary replication and security risks.

$Computers = @("<ComputerName>", "<ComputerName>", "<ComputerName>") 
 foreach ($Computer in $Computers) { 
   Remove-ADComputer -Identity $Computer -Confirm:$false 
 }

To remove multiple computers with specific location property, you shall use the below PowerShell cmdlet.

Note: Replace the <LocationConfiguredinProperties> with the value defined in each computer’s Location filed under Properties page.

Get-ADComputer -Filter 'Location -eq "<LocationConfiguredinProperties>"' | Remove-ADComputer

4. How to disable and move the inactive computers to a specific OU ?

In a large Active Directory hierarchy, a quick response during a security breach is essential. This includes identifying and disabling all inactive computers in AD, then isolating them in OUs with minimal permissions. These measures help to prevent unnecessary access or security risks via inactive AD computers and protect critical resources.

Utilize the script below to disable and move AD computer accounts using PowerShell.

$DaysInactive = 90 , $time = (Get-Date).Adddays(-($DaysInactive))
$ComputerList = @(Search-ADAccount -ComputersOnly -AccountInactive -TimeSpan 90 | Select Name, DistinguishedName)
$ComputerList 
foreach ($Computer in $ComputerList) { 
Disable-ADAccount -Identity  $Computer.DistinguishedName 
Move-ADObject -Identity $Computer.DistinguishedName -TargetPath ""
}
disable-inactive-computers-ps-script

Note: The above PowerShell script will disable computer accounts that have been inactive for over 90 days and move those to the specified OU.

Expert Tip: Schedule the above PowerShell script in Task Scheduler to automate the process of disabling inactive computer accounts and moving them to a specific organizational unit.

Get rid of lengthy and complex PowerShell scripts with AdminDroid’s advanced automation!

Create a custom flow agent with the required conditions and automate all your time-consuming Active Directory management processes in just a few clicks.

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!