How to Find Inactive Computers in Active Directory verwenden PowerShell.
To identify inactive computer accounts, you will always target those that have not logged on to Active Directory in the last 90 Tage. To accomplish this goal, you need to target theLastLogonTimeStamp property and then specify a condition with the time as shown in the following PowerShell commands:
$DaysInactive = 90
$time = (Get-Date).Adddays(-($DaysInactive))
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -ResultPageSize 2000 -resultSetSize $null -Properties Name, OperatingSystem, SamAccountName, DistinguishedName
If you wish to search computer accounts that have been inactive for more than 90 Tage, all you need to do is modify the$DaysInActive variable value. The current value is set at 90 Tage; Jedoch, you can specify your own value.
To export output to a CSV file, add theExport-CSV PowerShell cmdlet as shown in the following command:
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -ResultPageSize 2000 -resultSetSize $null -Properties Name, OperatingSystem, SamAccountName, DistinguishedName | Export-CSV "C:\Temp\StaleComps.CSV" –NoTypeInformation
¿Porqué me devuelve en algunas cuentas Enabled: WAHR?
Hallo. Can you add any screenshots for this?