![](https://it-infrastructure.solutions/content/images/2023/11/image-10.png)
This article has not been completed yet. However, it may already contain helpful Information and therefore it has been published at this stage.
# PowerShell Command to be run on a DC
# It displays all computer objects that are inactive and where no login activity has taken place in the last 31 days.
Search-ADAccount -ComputersOnly -AccountInactive -TimeSpan "31" | Where-Object { $_.Enabled -eq $true } | Select Name
# tested on a Windows Server 2019
![](https://it-infrastructure.solutions/content/images/2023/11/image-11.png)
References:
Powershell script to find old AD computers by last login time (spiceworks.com)
Where-Object (Microsoft.PowerShell.Core) - PowerShell
Das Where-Object Cmdlet wählt Objekte mit bestimmten Eigenschaftswerten aus der Auflistung von Objekten aus, die an das Objekt übergeben werden. Sie können z. B. das Where-Object Cmdlet verwenden, um Dateien auszuwählen, die nach einem bestimmten Datum, Ereignissen mit einer bestimmten ID oder Compu…
![](https://learn.microsoft.com/media/logos/logo-powershell-social.png)