Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


when users are forced to change their password

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> when users are forced to change their password
  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 >>
 when users are forced to change their password - 4/15/2005 8:35:20 AM   
  kennytx

 

Posts: 2
Score: 0
Joined: 4/12/2005
From:
Status: offline
new to vb.

due to a password policy, i have to write a script to spam our users when they have 10 days or less before they have to change their domain password.

i have the following:
-calculates the number of days left on their password
-generates a list of users with 10 days or less

i am relying on the "passwordlastchanged" date value of the user for the calculations. my code fails if the "user must change password at next logon" is checked because the date value is not set.

it is probably something simple, but i have tried
isdate(ouser.passwordlastchanged)
isnull(ouser.passwordlastchanged)
ouser.passwordlastchanged=0
variations of the same on "pwdlastset"

any help is appreciated.

================

Do While oInFile.AtEndOfStream <> True
strDomainDN = "my.company"
strUserDN = oInFile.ReadLine
Set oDomain = GetObject("LDAP://" & strDomainDN)
Set maxPwdAge = oDomain.Get("maxPwdAge")
numDays = CCur((maxPwdAge.HighPart * 2 ^ 32) + _
maxPwdAge.LowPart) / CCur(-864000000000)
Set oUser = GetObject("LDAP://" & strDomainDN & "/" & strUserDN)
**whenPasswordExpires = DateAdd("d",numDays,oUser.PasswordLastChanged)
offset = Datediff("d", oUser.PasswordLastChanged, date)
if ((numdays - offset) < 10 AND (numdays - offset) > 0) then
oOutFile.WriteLine oUser.name & "@my.company"
Loop
 
 
Post #: 1
 
 Re: when users are forced to change their password - 4/15/2005 8:41:13 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
iempty(ouser.passwordlastchanged)

(in reply to kennytx)
 
 
Post #: 2
 
 Re: when users are forced to change their password - 4/15/2005 9:15:01 AM   
  kennytx

 

Posts: 2
Score: 0
Joined: 4/12/2005
From:
Status: offline
thanks token!

that worked like a champ.

(in reply to kennytx)
 
 
Post #: 3
 
 Re: when users are forced to change their password - 4/15/2005 9:23:00 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
No problem =)

(in reply to kennytx)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> when users are forced to change their password 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