Guest flipje Posted November 18, 2004 Posted November 18, 2004 Allmost finished by DVD... Got stuck on one thing I wanna get it working....but... First of all sorry for my bad English.The thing I wanna do is a build a little script the read outs the users input about computername, username, password and the Full Username (top of start menu). After that the new user account must me added to the local administrators group and registrykeys will be made to force autologon. The script will be executed at the end of runonce.cmd, pc will reboot and viola...Allready found a tool "baptize.exe" to rename. (cmd: baptize.exe computername)This is what I all ready have...Dim usrNameDim PassWordusrName = Inputbox("Enter User Name","Enter Name")PassWord = Inputbox("Enter password","Enter your Password")Set WShell = CreateObject("WScript.Shell")WShell.Run "net user"& UsrName & PassWord &"/add"WShell.Run "net net localgroup Administrators"& usrName &"/add"WShell.Run "net accounts /maxpwage:unlimited"dim wsh set wsh=CreateObject("WScript.Shell") wsh.regwrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName",usrNamewsh.regwrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword",PassWordwsh.regwrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon","1"Can anybody helpme Thx...
tguy Posted November 18, 2004 Posted November 18, 2004 Here is a copy of the script I use to add a user and add them to the administrator's group.'****************************************************************Option Explicit' On Error Resume NextConst UF_SCRIPT = &H1Const UF_ACCOUNTDISABLE = &H2Const UF_HOMEDIR_REQUIRED = &H8Const UF_LOCKOUT = &H10Const UF_PASSWD_NOTREQD = &H20Const UF_PASSWD_CANT_CHANGE = &H40Const UF_TEMP_DUPLICATE_ACCOUNT = &H100Const UF_NORMAL_ACCOUNT = &H200Const UF_INTERDOMAIN_TRUST_ACCOUNT = &H800Const UF_WORKSTATION_TRUST_ACCOUNT = &H1000Const UF_SERVER_TRUST_ACCOUNT = &H2000Const UF_DONT_EXPIRE_PASSWD = &H10000Const UF_MNS_LOGON_ACCOUNT = &H20000Dim objComputer, objGroup, objUser, objWSHNetwork, ObjPwdExpires, strComputerName, strFullName, strPassword, strUserNameSet objWSHNetwork = WScript.CreateObject("WScript.Network")strComputerName = objWSHNetwork.ComputerNameSet objComputer = GetObject("WinNT://" & strComputerName)Set objGroup = GetObject("WinNT://" & strComputerName & "/Administrators")strUserName = "Admin2"strFullName = "Emergency User"strPassword = "********"Set objUser = objComputer.Create("User", strUserName)objUser.SetPassword strPasswordobjUser.FullName = strFullNameobjUser.Put "description", "Local User Account for Emergencies"objUser.Put "UserFlags", objUser.UserFlags Or UF_PASSWD_CANT_CHANGEobjUser.Put "UserFlags", objUser.UserFlags Or UF_DONT_EXPIRE_PASSWDobjUser.SetInfo'*** Add user to Administrators Group ***objGroup.Add "WinNT://" & strComputerName & "/" & strUserNameobjUser.SetInfo' MsgBox "Completed adding user " & strUserName & ".", vbInformation, "Execution completed" Obviously substitute real password for asterisks.
Guest flipje Posted November 20, 2004 Posted November 20, 2004 Allmost finished... I cant find any vbscript or howto creat and add a new user... The script below renames the computer, sets owner and company and adds the autologin with the given info from the user..The only thing left is to create the user and add this account to the adminstrators group.Could someone give me a little help please...Thankx....'Add User, Computername and Change Registered Owner/Organization.Option ExplicitSet ws = WScript.CreateObject("WScript.Shell")Dim ws, t, p0, p1, p2, p3, p4, p5, p11, n, g, j, h, f, k, cn, cg, cj,Suser,m,p6,p7,o,Spass,DDomainDim itemtypep0 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"p11= "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"p1 = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\"p2 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName\"p3 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\"p4 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\"p5 = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"p6 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"p7 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"n = ws.RegRead(p1 & "RegisteredOwner")g = ws.RegRead(p1 & "RegisteredOrganization")j = ws.RegRead(p2 & "ComputerName")h = ws.RegRead(p3 & "NV Hostname")f = ws.RegRead(p4 & "ComputerName")k = ws.RegRead(p5 & "NV Hostname")m = ws.RegRead(p6 & "DefaultUserName")o = ws.RegRead(p7 & "DefaultPassword")t = "Computer en Gebruikers Info"cn = InputBox("Type de eigenaar van de computer in en klik OK", t, n)If cn <> "" Thenws.RegWrite p1 & "RegisteredOwner", cnEnd IfSuser = InputBox("Type uw gebruikersnaam in en klik OK", t, m)If Suser <> "" Thenws.RegWrite p6 & "DefaultUserName", SuserEnd IfSpass = InputBox("Type uw wachtwoord in en klik OK", t, o)If Suser <> "" Thenws.RegWrite p7 & "DefaultPassword", SpassEnd Ifcg = InputBox("Type uw bedijfsnaam in en klik ok", t, g)If cg <> "" Thenws.RegWrite p1 & "RegisteredOrganization", cgEnd Ifcj = InputBox("Type new Computer name and click OK", t, j)If cj <> "" Thenws.RegWrite p2 & "ComputerName", cjws.RegWrite p3 & "NV Hostname", cjws.RegWrite p4 & "ComputerName", cjws.RegWrite p5 & "NV Hostname", cjws.RegWrite p0 & "DefaultDomainName", cjws.RegWrite p11 & "AutoAdminLogon","1"End If
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