April 17, 200917 yr 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
April 18, 200917 yr 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
Create an account or sign in to comment