PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms..win.server.scripting > I need to set a user must to change his password at next logon
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
I need to set a user must to change his password at next logon

Réponse
 
LinkBack Outils de la discussion
Vieux 18/09/2007, 11h42   #1
Dani
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut I need to set a user must to change his password at next logon

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.

  Réponse avec citation
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
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
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h44.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10032 seconds with 11 queries