Afficher un message
Vieux 18/09/2007, 13h48   #2
Richard Mueller [MVP]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: I need to set a user must to change his password at next logon

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


  Réponse avec citation
 
Page generated in 0,06272 seconds with 9 queries