targa Posted April 17, 2009 Posted April 17, 2009 I am trying to write a script to create a new account after windows finishes to install... manged to do the following but would like that the script pops-up a window asking for the username and password rather than being written in the vb script. Any help please????Option Explicit' On Error Resume NextDim objComputer, objGroup, objUser, objWSHNetwork, strComputerName, strFullName, strPassword, strUserNameSet objWSHNetwork = WScript.CreateObject("WScript.Network")strComputerName = objWSHNetwork.ComputerNameSet objComputer = GetObject("WinNT://" & strComputerName)Set objGroup = GetObject("WinNT://" & strComputerName & "/Administrators")strUserName = "username"strFullName = "user2"strPassword = "password"Set objUser = objComputer.Create("User", strUserName)objUser.SetPassword strPasswordobjUser.FullName = strFullNameobjUser.SetInfoobjGroup.Add "WinNT://" & strComputerName & "/" & strUserNameobjUser.SetInfo
gunsmokingman Posted April 18, 2009 Posted April 18, 2009 Try thisOption Explicit' On Error Resume Next Dim objComputer, objGroup, objUser, objWSHNetwork, strComputerName, strFullName, strPassword, strUserName Set objWSHNetwork = WScript.CreateObject("WScript.Network") strComputerName = objWSHNetwork.ComputerName Set objComputer = GetObject("WinNT://" & strComputerName) Set objGroup = GetObject("WinNT://" & strComputerName & "/Administrators") Dim Password, UserName While UserName = "" UserName = InputBox("Type In Your User Name") Wend While Password = "" Password = InputBox("Type In Your Password") Wend strUserName = UserName strFullName = "user2" strPassword = Password Set objUser = objComputer.Create("User", strUserName) objUser.SetPassword strPassword objUser.FullName = strFullName objUser.SetInfo objGroup.Add "WinNT://" & strComputerName & "/" & strUserName objUser.SetInfo
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now