Error in password setting

General Discussion about LDAP Administrator

Moderator: Support

Error in password setting

Postby reema » Sun Jul 09, 2006 5:05 pm

Can anyone help me please?
I'm having an error in using the function .SetPassword or in the If condition and i don't know why.

This is the code:

Dim ObjOU, objUser, objRootDSE
Dim strContainer, strDNSDomain, strPassword
Dim intCounter, intAccValue, intPwdValue

'Bind to Active Directory Domain
Set objRootDSE = GetObject("LDAP://RootDSE")
'strDNSDomain = objRootDSE.Get("DefaultNamingContext")

'Important change OU= to reflect your domain
'strContainer = "cn=users,dc=aus,dc=edu"
'strPassword = "P@ssword1"
'strContainer = strContainer & strDNSDomain

'Here is where we set the value to enable the account
'512 = Enable, 514 = Disable
'intAccValue = 512

'Here we force a change of password at next logon
'intPwdValue = 0' Default is -1

Set ObjOU = GetObject("LDAP://" & "cn=users,dc=aus,dc=edu")
' For each objUser in ObjOU
If objUser.class = "user" Then
objUser.SetPassword "123"
' objUser.Put "userAccountControl ", intAccValue
' objUser.Put "PwdLastSet", intPwdValue
End If
' Next

WScript.Echo "Password is " & strPassword '& vbCr & _
'"UserAccoutControl = " & intAccValue & vbCr & "Check" & strContainer


And this is the error:

Script: C:\Active Directory Testing Code\password.vbs
Line: 23
char: 13
Error: Object Required: "
Code: 800A01A8
Source: Microsoft VBScript runtime error

I hope anyone can help me please
Posts: 1
Joined: Sun Jul 09, 2006 4:52 pm

Return to General Discussion

Who is online

Users browsing this forum: Bing [Bot] and 4 guests