| |
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
|
|