Hello,
I am looking to use a vbscript that will list a systems local password policy.
I have the following which lists the Domain password policy, but would like to adapt it for a local systm password policy listing.
set objRoot = getobject("LDAP://RootDSE")
set objDomain = getobject("LDAP://" & objRoot.get("defaultNamingContext"))
maximumPasswordAge = int(Int8ToSec(objDomain.get("maxPwdAge")) / 86400) 'convert to days
minimumPasswordAge = Int8ToSec(objDomain.get("minPwdAge")) / 86400 'convert to days
minimumPasswordLength = objDomain.get("minPwdLength")
accountLockoutDuration = Int8ToSec(objDomain.get("lockoutDuration")) / 60 'convert to minutes
lockoutThreshold = objDomain.get("lockoutThreshold")
lockoutObservationWindow = Int8ToSec(objDomain.get("lockoutObservationWindow")) / 60 'convert to minutes
passwordHistory = objDomain.get("pwdHistoryLength")
Wscript.Echo "Domain Account Policy"
wscript.echo vbtab & "MinimumPasswordAge: " & minimumPasswordAge & " days" & vbcrlf & _
vbtab & "MaximumPasswordAge: " & maximumPasswordAge & " days" & vbcrlf & _
vbtab & "MinimumPasswordLength: " & minimumPasswordLength & " characters" & vbcrlf & _
vbtab & "EnforcePasswordHistory: " & passwordHistory & " passwords remembered" & vbcrlf & _
vbtab & "AccountLockoutDuration: " & accountLockoutDuration & " minutes" & vbcrlf & _
vbtab & "AccountLockoutThreshold: " & lockoutThreshold & " invalid logon attempts" & vbcrlf & _
vbtab & "Reset account lockout counter after: " & lockoutObservationWindow & " minutes"
Can the above be adapted for a specific local server or can you provide a method of obtaining this information using vbscript or another language?
I have tried a convoluted method of using pstools and secedit with a vbscript, but there are some problems with the psexec service hanging so I would prefer a pure scripting approach.
Thank you for any assistance you could provide.