| |
jaeden99
Posts: 1
Score: 0
Joined: 4/12/2006
Status: offline
|
I am trying to update the oldpassword.wsf script to check to see if the don't expire password property is enabled, if it is enabled , don't expire password just show the number of days its' been since password was changed if not enabled , show the number of days since password changed and expire password. This is what I've added so far: If intUserAccountControl And ADS_UF_DONT_EXPIRE_PASSWD Then Verbose " does not expired" output oadobject.Get("SAMAccountName") & " password never expires" If DateDiff("d",oADObject.PasswordLastChanged,Date) > CInt(WScript.Arguments.named("age")) Then Output oADObject.Get("sAMAccountName") & " last changed On " & oADObject.PasswordLastChanged & " (" & DateDiff("d",oADObject.PasswordLastChanged,Date) & " days old)" end if else ' if err <> 0 then If err.number = E_ADS_PROPERTY_NOT_FOUND Then output oadobject.Get("SAMAccountName") & " the password has never been set." else 'Add code to expire password for those accounts that do not have don't expire password enabled If DateDiff("d",oADObject.PasswordLastChanged,Date) > CInt(WScript.Arguments.named("age")) Then Output oADObject.Get("sAMAccountName") & " last changed On " & oADObject.PasswordLastChanged & " (" & DateDiff("d",oADObject.PasswordLastChanged,Date) & " days old)" 'If Err <> 0 Then ' 'Verbose " (never changed)" ' 'Output oADObject.Get("sAMAccountName") & " password never changed" 'Else If err.number = E_ADS_PROPERTY_NOT_FOUND Then output oadobject.Get("SAMAccountName") & " the password has never been set." end if end if end if end if 'end if 'end if
|
|