Here's a quick one-liner to find out how old the administrator password age (in days) is on a remote machine.
Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
([adsi]"WinNT://<COMPUTERNAME>/administrator").passwordage.value/86400
This requires RPC/DCOM access to the remote computer. Or use PowerShell remoting with Invoke-Command:
invoke-command { new-object PSObject -property @{ Computername = $env:computername AdminAge = ([adsi]"WinNT://$env:computername/administrator").passwordage.value/86400 } } -ComputerName $computers | Select Computername,AdminAge
OK, I got a number back. 862.877465277778. Is that days, weeks, seconds??
That should be the number of days.
Great on-liner, I use it continually in our enterprise. For readability in one of my scheduled tasks that sends out overview emails, I added formatting to limit the returned data to one decimal point (boss no likey long numbers). My modification below:
“{0:N1}” -f (([adsi]”WinNT://COMPUTERNAME/administrator”).passwordage.value/86400)