Afficher un message
Vieux 19/09/2007, 11h18   #3
Dani
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

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

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