|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi!!
Sorry! I need to set a user must to change his password at next logon. I have used this vbs code, but it doesn´t work: Set user = GetObject("LDAP://CN=" & usu & ",OU=" & nivel &",OU=XX,OU=YY,DC=ZZ,DC=UU") user.SetPassword "Password" user.SetInfo user.Put "pwdLastSet", 0 user.SetInfo Someone has any idea.?? Thank You very much. Regards. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Dani wrote:
> Sorry! I need to set a user must to change his password at next logon. > I have used this vbs code, but it doesn´t work: > > Set user = GetObject("LDAP://CN=" & usu & ",OU=" & nivel > &",OU=XX,OU=YY,DC=ZZ,DC=UU") > user.SetPassword "Password" > user.SetInfo > user.Put "pwdLastSet", 0 > user.SetInfo > > Someone has any idea.?? Possibly the user is configured either to not require a password or for the password to not expire. To make sure these bits are not set in the userAccountControl attribute, use code similar to: ======= Const ADS_UF_PASSWD_NOTREQD = &H20 Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000 lngFlag = user.userAccountControl ' Test if "password not required" bit set. If (lngFlag And ADS_UF_PASSWD_NOTREQD <> 0) Then ' Turn off the bit. lngFlag = lngFlag Xor ADS_UF_PASSWD_NOTREQD End If ' Test if "password does not expire" bit set. If (lngFlag And ADS_UF_DONT_EXPIRE_PASSWD <> 0) Then ' Turn of the bit. lngFlag = lngFlag Xor ADS_UF_DONT_EXPIRE_PASSWD End If user.Put "userAccountControl", lngFlag user.SetInfo ========== Another possibility is that the user is not allowed to change their password. That would require modifications to the user object security descriptor. -- Richard Mueller Microsoft MVP Scripting and ADSI Hilltop Lab - http://www.rlmueller.net -- |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Hi Richard.
Thanks for all. But i suppose the problem is that the users account are set to not expire. The user has the right to change his password. I think , i would to make another type of user control to set the this flag. Could you me again?? Thank you very much again. Dani "Richard Mueller [MVP]" wrote: > Dani wrote: > > > Sorry! I need to set a user must to change his password at next logon. > > I have used this vbs code, but it doesn´t work: > > > > Set user = GetObject("LDAP://CN=" & usu & ",OU=" & nivel > > &",OU=XX,OU=YY,DC=ZZ,DC=UU") > > user.SetPassword "Password" > > user.SetInfo > > user.Put "pwdLastSet", 0 > > user.SetInfo > > > > Someone has any idea.?? > > Possibly the user is configured either to not require a password or for the > password to not expire. To make sure these bits are not set in the > userAccountControl attribute, use code similar to: > ======= > Const ADS_UF_PASSWD_NOTREQD = &H20 > Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000 > > lngFlag = user.userAccountControl > ' Test if "password not required" bit set. > If (lngFlag And ADS_UF_PASSWD_NOTREQD <> 0) Then > ' Turn off the bit. > lngFlag = lngFlag Xor ADS_UF_PASSWD_NOTREQD > End If > ' Test if "password does not expire" bit set. > If (lngFlag And ADS_UF_DONT_EXPIRE_PASSWD <> 0) Then > ' Turn of the bit. > lngFlag = lngFlag Xor ADS_UF_DONT_EXPIRE_PASSWD > End If > user.Put "userAccountControl", lngFlag > user.SetInfo > ========== > Another possibility is that the user is not allowed to change their > password. That would require modifications to the user object security > descriptor. > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > > |
|
![]() |
| Outils de la discussion | |
|
|