ASP A.D Query

Associate
Joined
13 Jul 2005
Posts
738
Location
Brisbane
Hi Chaps,

bit of a newb-a-tron to ASP and have the below sub to reset a user's A.D password.

It currently works, but i want it to throw up an error box if the username entered is not recognised by the A.D, and then return to the start of the sub.

Code:
'Reset Password
Sub Btn3_OnClick
Dim User
Dim UserName
UserName = inputbox("Enter the Username you want to change the password for :","UserName","")
		if len(trim(UserName)) = 0 then
		MsgBox "Please specify a username.",,"SMS 2003 Remote Control"
		exit sub
		end if
NewPassword = inputbox("Enter the password you want it changed to :","password","")
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Call User.SetPassword(NewPassword)
User.SetInfo
End Sub

Thanks in advance,

Tucks
 
Back
Top Bottom