VBScript for creating local account and adding to admin group used to work prior to logout / login to test newly created account: -
set objshell = createobject("wscript.shell") set objenv = objshell.environment("process") strcomputer = objenv("computername") struser = inputbox("enter username new admin account.") strpass = inputbox("enter password new account.") set colaccounts = getobject("winnt://" & strcomputer & ",computer") set objuser = colaccounts.create("user", struser) objuser.setpassword strpass const ads_uf_dont_expire_passwd = &h10000 objpasswordexpirationflag = ads_uf_dont_expire_passwd objuser.put "userflags", objpasswordexpirationflag objuser.setinfo set group = getobject("winnt://" & strcomputer & "/administrators,group") group.add(objuser.adspath)
sigh. simple matter of "run administrator".
Comments
Post a Comment