R – How to create a user account in Windows Vista using VBScript

vbscriptwindows-vista

How to create a user account in Windows Vista using VBScript?

I'm using the following script. It's working fine on Windows XP, but gives me an error on Windows Vista:

strUserName = "username"
strPassword = "password"
strComputer = "."
set objSystem = GetObject("WinNT://" & strComputer)
set objUser = objSystem.Create("user", strUserName)
objUser.SetPassword strPassword
objUser.SetInfo

Best Answer

I am able to run this script on my Vista box just fine, and it creates the user.

I suspect this is a UAC issue?

Vista’s UAC: How to elevate scripts (VBScript and JScript)

Related Topic