To change a password in AD for a given user, use this script below. Be sure to fill in the LDAP query string with the proper parameters.
on error resume next
txtUserName = InputBox("Enter Users Full name [Amit A Barman]:","Input")
oldPwd = InputBox("Enter Users Old Password:","Input")
newPwd = InputBox("Enter Users Temporary New Password:","Input")
Set objUser = GetObject("LDAP://cn=" & txtUsername & "OU=Users,OU=Test2,OU=Test,DC=ds,DC=test,DC=fabrikam,DC=com")
objUser.ChangePassword oldPwd, newPwd
objUser.Put "pwdLastSet", 0
objUser.SetInfo
MsgBox("Temporary Password Set!",48,"")
No comments:
Post a Comment