Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
When the script tries to change the old password to the new password, I get the "WIL Extender Error: 562: Invalid user name". I can change the password manually (through Computer/Manage/Users) to the same password I'm using through the script, so I know it's not a password policy problem. I can also use the "*UNKNOWN*" variable, and it works just fine to the same username. Am I doing something wrong in the command line?
Per some prevous suggestions, here is the text from the wwwbatch.ini:
[WWWNT34I] LastError=2221 (NetUserChangePassword)Here is the script that I'm using.
AddExtender('wwwnt34i.dll') MachineSID = wntLsaPolGet('','AccountDomain',2) AdministratorSID = StrCat(MachineSID, "-500") AdministratorName = wntAcctInfo('',AdministratorSID,2,0) Message("Administrator name is currently:", AdministratorName) changepasswd=AskYesNo("Change Password?", "Would you like to change the password for the local administrator account?") If changepasswd==@No Message("Bye","Have a nice day!") exit endif response=AskYesNo("Changing Old Admin Acct. Password", "Do you know the old password?") If response == @Yes old=AskPassword("Change Password","Enter old password") while @TRUE new1=AskPassword("Change Password","Enter new password") new2=AskPassword("Change Password","Enter new password again") if new1==new2 then break Message("Try Again","The new passwords you entered do not match") endwhile result=wntChgPswd("", AdministratorName, old, new1) if result Message("Password","Successfully changed") else Message("Password","Not changed") endif else while @TRUE change1=AskPassword("Change Password","Enter new password") change2=AskPassword("Change Password","Enter new password again") if change1==change2 then break Message("Try Again","The new passwords you entered do not match") endwhile doit=wntChgPswd("", "%AdministratorName%", "*UNKNOWN*", change1) if doit Message("Password","Successfully changed") else Message("Password","Not changed") Endif Endif exit
I'm going to make a wild guess that a different API function is used for changing passwords when the old passowrd is known and for Admins forcing password changes. And that thes functions resolve "partial user names" in a different manner.
It would be interesting to see the actual code used here. are you using the form 'johnd' for the username or 'somemachine\johnd' or 'somedomain\johnd'
Please test this in your environment and let me know if it eliminates the error that you are observing when your script runs.
Sample Code:
AddExtender("wwwnt34i.dll") old=AskPassword("Change Password","Enter old password") while @TRUE new1=AskPassword("Change Password","Enter new password") new2=AskPassword("Change Password","Enter new password again") if new1==new2 then break Message("Try Again","The new passwords you entered do not match") endwhile user = wntUserInfo(o) computer = ItemExtract(1, WinSysInfo(), @TAB) rslt=wntChgPswd(computer, user, old, new1) if rslt Message("Password","Successfully changed") else Message("Password","Not changed") endif
sysinfo = WinSysInfo( ) computer = ItemExtract(1, sysinfo, @TAB) ...added the next line after old an new passwords were entered: result=wntChgPswd( strcat('\\',computer), AdministratorName, old, new1)
Article ID: W16527
File Created: 2005:02:18:12:21:16
Last Updated: 2005:02:18:12:21:16