Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to reset passwords?

Status
Not open for further replies.
May 29, 2004
1,336
GB
Hi all, a very generous guy has supplied me with a script to reset passwords in an Active Directory environment the only problem is that it relies on the OU being specified.
Could some one suggest a way that this could be altered so that the OU will not have to be specified?

Would it be posible to extract a flat file from the PDC emulator?

Cheers.



Code:
'==========================================================================
'
' NAME: PasswordReset.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 11/30/2004
'
' COMMENT: <comment>
'
'==========================================================================

UserString = InputBox "Enter Username to set password for.","What User?"
newPass = InputBox "What should the password be?"


Set objUser = GetObject _
 ("LDAP://cn=" & UserString & ",ou=users,dc=fabrikam,dc=com")
objUser.SetPassword newPass

If err then
    msgbox "Error Encountered"
else
    msgbox "Password Set!"
End if
 
This should get you pointed in the right direction:
Code:
Dim objNTUser,groupname
UserString = InputBox ("Enter Username to set password for.")
newPass = InputBox ("What should the password be?")
Set objNTUser = GetObject("WinNT:[COLOR=blue]//domain-name/[/color]" & UserString &",User")
objNTUser.SetPassword newPass

If err then
    msgbox "Error Encountered"
else
    msgbox "Password Set!"
End if

You will need to put your domain name in the area colored in blue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top