Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Password Expiration

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,33462
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Password Expiration
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Password Expiration - 4/12/2006 8:03:54 AM   
  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
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Password Expiration Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts