How to determine Computer Account Password Age (in Active Directory)

Copy and Paste this script to an empry Computer.Account.vbs file

On Error Resume Next 
 
Set rs = CreateObject("ADODB.Recordset") 
Set objRootDSE = GetObject("LDAP://RootDSE") 
strDNSDomain = objRootDSE.Get("defaultNamingContext") 
 
rs.Open "<LDAP://" & strDNSDomain & ">;(objectClass=computer);name,distinguishedName", "provider = ADsDSOObject" 
 
strMachineList = "" 
 
Do Until rs.EOF 
    Set objComputer = GetObject("LDAP://" & rs.Fields("distinguishedName") & "") 
 
    dtmValue = objComputer.PasswordLastChanged  
    dtmDiff = Datediff("d", dtmValue, Now) 
        strLasttime = rs.Fields("Name") & " " & dtmDiff & vbCRLF 
        strMachineList = strMachineList & strLasttime  
          rs.MoveNext 
Loop 
 
WScript.Echo strMachineList

Now use this script in the following command to create an entire output of all your system in AD with there computer account password age

cscript Computer.Account.vbs > C:\temp.txt

Or use this command to just show you the password age of a certain computer

cscript Computer.Account.vbs | FIND /I "<COMPUTERNAME>"

Keep in MIND to use this ON THE DOMAIN CONTROLLER

ENJOY!@!