Script to change password in AD

  • Thread starter Thread starter Spin
  • Start date Start date
S

Spin

Situation:

Windows 2000-native mode single domain, with 5 domain controllers. Users are
not broken out into OUs, they are still in the standard built-in Users
container.

On a DC, when I run the following VBScript, I get an error on line 2. Don't
know what I'm doing wrong. All I want to do is change the user's password
by using the script instead of ADUC.

Script:

Set objUser = GetObject_
("LDAP://cn=User1,cn=users,dc=domain,dc=com")
objUser.SetPassword "Hello2U"
 
Situation:

Windows 2000-native mode single domain, with 5 domain controllers. Users are
not broken out into OUs, they are still in the standard built-in Users
container.

On a DC, when I run the following VBScript, I get an error on line 2. Don't
know what I'm doing wrong. All I want to do is change the user's password
by using the script instead of ADUC.

Script:

Set objUser = GetObject_
("LDAP://cn=User1,cn=users,dc=domain,dc=com")
objUser.SetPassword "Hello2U"

How about simply using the following from the command prompt?:

net user User1 Hello2U /domain

Clay Calvert
(e-mail address removed)
Replace "W" with "L"
 
Spin said:
Script:

Set objUser = GetObject_
("LDAP://cn=User1,cn=users,dc=domain,dc=com")
objUser.SetPassword "Hello2U"

Wouldn't it be just as easy to do:

net user user1 Hello2U

?
There should be a space before the "_" in the first line
e.g. "GetObject _"

You can also try the following syntax (but you need to know the
old password).

Set objUser = GetObject _
("LDAP://cn=User1,cn=users,dc=domain,dc=com")
objUser.ChangePassword "OldPass", "Hello2U"
 
Spin said:
Situation:

Windows 2000-native mode single domain, with 5 domain controllers. Users are
not broken out into OUs, they are still in the standard built-in Users
container.

On a DC, when I run the following VBScript, I get an error on line 2. Don't
know what I'm doing wrong. All I want to do is change the user's password
by using the script instead of ADUC.

Script:

Set objUser = GetObject_
("LDAP://cn=User1,cn=users,dc=domain,dc=com")
objUser.SetPassword "Hello2U"

What error do you get on line 2?

I don't logon to our domain controllers to do account management, so please
bear with me when I ask: is ADSI installed on them?

/Al
 
Matt Hickman said:
"Spin" <[email protected]> wrote in message

Wouldn't it be just as easy to do:

net user user1 Hello2U

?
There should be a space before the "_" in the first line
e.g. "GetObject _"

Actually, no, this is not necessary.
You can also try the following syntax (but you need to know the
old password).

Set objUser = GetObject _
("LDAP://cn=User1,cn=users,dc=domain,dc=com")
objUser.ChangePassword "OldPass", "Hello2U"

The second line would be the binding string. Since this is the same as his,
it would still throw an error, would it not?

But here's a question for him: is this the *exact* binding string you are
using? If so, is your domain actually called "domain.com"?

/Al
 
Al said:
(snip)

What error do you get on line 2?

I don't logon to our domain controllers to do account management, so please
bear with me when I ask: is ADSI installed on them
Hi

As he is running the script from a Win2k or better DC (because it is
Windows 2000-native mode domain), ADSI will be available as default.
 
yes. vb says that "_" has to appear by itself for a line of code to continue
on the next line.
so if there is no space before it, it could very well be part of a text
string.


Matt Hickman said:
"Al Dunbar [MS-MVP]" <[email protected]> wrote in message
Actually, no, this is not necessary.

Odd, I get a compilation error if there is no space.
 
My oops - sorry...

/Al

yes. vb says that "_" has to appear by itself for a line of code to continue
on the next line.
so if there is no space before it, it could very well be part of a text
string.


Matt Hickman said:
"Al Dunbar [MS-MVP]" <[email protected]> wrote in message
There should be a space before the "_" in the first line
e.g. "GetObject _"

Actually, no, this is not necessary.

Odd, I get a compilation error if there is no space.
 
Back
Top