Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Find the local Administrator password changed date.Script is not acurate.

Hi,

Find the local Administrator password changed date.Script is not acurate.
Script works but gets the dates for machines that are timed out also. So i feel its not acurate.

Can anyone help me to check why it does not get the exact date.

Regards
Sharath

Const ForAppending = 8
Const ForReading = 1
 On Error Resume Next
Set fso=CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("C:\pass_changed.txt")
Set objNetwork = CreateObject("Wscript.Network")
 
Set objFile=fso.OpenTextFile("C:\computers.txt", ForReading)
 
Do Until objFile.atEndofStream
     strComputer = objFile.ReadLine
    
Set objUser = GetObject("WinNT://" & strComputer & "/administrator")
 
intPasswordAge = objUser.PasswordAge
intPasswordAge = intPasswordAge * -1 
dtmChangeDate = DateAdd("s", intPasswordAge, Now)
 
objTextFile.WriteLine "Password for " & strComputer & " was last changed: " & dtmChangeDate
Loop

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Krys_K
Krys_K
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial