Code corner has been rather quiet lately, so today I am going to share one of my favorite scripts.
On a day-to-day basis I get many people asking for me to reset their passwords which can get rather tedious, to say the least, so I wrote this script which will reset a user account in a specific OU and force a password change on login.
If you want to use this script just change the OU and Domain to match your own, and of course the password you want it to be reset to.
The script also prompts you to confirm who you want to reset by showing the users full name (pulled from AD)
Copy and paste or hit up the download link below.
on error resume next
User = Inputbox("Enter Username")
Set objUser = GetObject("LDAP://cn=" & User & ",ou=Users,dc=AD_DOMAIN")
if err.number <> 0 Then
msgbox "User Not Found"
wscript.quit 0
else
Result = msgbox("Reset " & objUser.Fullname & "'s Password?", vbyesno)
If Result = vbno then wscript.quit 0
objUser.SetPassword("12345678")
objUser.Put "PwdLastSet", 0
objUser.SetInfo
msgbox "Password Reset"
wscript.quit 0
end if
Set objUser = Nothing
113 Downloads : UserReset 442 bytes

Its been a week or so since I’ve added to the Code Corner so today’s entry is a small, simple but useful script for shutting down a Windows PC using VBS and WMI.

No Comments »