nichols
(Lurker)
2003-04-01 05:47 AM
Changing Passwords Under NT/2k

I found a example code set on here that uses:
Function UserChangePass($oldpassword,$newpassword)

$UserID = GetObject("WinNT://@domain/@userid")

If @error = 0
$Userid.changepassword($oldpassword,$newpassword)
Exit(@error)
Else
Exit(5)
EndIf
EndFunction

Does this work for 2k? I've tried several times, to no avail.. It says it cant change it..


Howard Bullock
(KiX Supporter)
2003-04-01 06:13 AM
Re: Changing Passwords Under NT/2k

This works for me on an NT4 domain. I can't try it for 7 days on our AD domain because of the password policy.

This is the code I used:
code:
break on
$UserID = GetObject("WinNT://domain/account")
? "GetObject: @error @serror"

If @error = 0
$Userid.changepassword('123qweZXC','ABC123xyz!')
? "@error @serror"
Else
? "@error @serror"
EndIf

The error I get. I believe that it is as a result of the policy.
quote:

1 COM exception error "changepassword" ((null) - (null)) [1/1]

In your script you used @domain. Should you be using @ldomain?

[ 01. April 2003, 06:21: Message edited by: Howard Bullock ]