cancerface Posted October 6, 2006 Posted October 6, 2006 Hi mandrake10,I wrote a tool that can be used to change the computer name and registered owner/organization using a GUI. In addition it can take values from an INI file where you can specify different MACs for different PCs and depending on the MAC address detected upon execution, the appropriate values will be automatically picked from the INI file. It can be found in this threadCF
Beta4Me Posted October 6, 2006 Author Posted October 6, 2006 (edited) Hi mandrake10,I wrote a tool that can be used to change the computer name and registered owner/organization using a GUI. In addition it can take values from an INI file where you can specify different MACs for different PCs and depending on the MAC address detected upon execution, the appropriate values will be automatically picked from the INI file. It can be found in this Thread.CFThanks, this is Really Cool and I will most likely use it. But if someone can answer the question in my previous post, it will be much appreciated. Thanks, Edited October 6, 2006 by mandrake10
cancerface Posted October 6, 2006 Posted October 6, 2006 I am using direct API calls to set the new computer name and upon reboot the correct new name is displayed.There is also a freeware command line tool that does the same called compname.exe.Looking at your HTA script, you change the computer name in the registry only. I am under the impression that this is not the way to change the NetBios name and that's why you end up with the old name.CF
Beta4Me Posted October 7, 2006 Author Posted October 7, 2006 Can someone please convert this:net user %USERNAME% %PASS% /addnet localgroup %GROUP% %USERNAME% /addnet accounts /maxpwage:unlimitedto a VBScript Replacing:%USERNAME% -> strUser%PASS% -> strPass%GROUP% -> strGroup
gunsmokingman Posted October 7, 2006 Posted October 7, 2006 This is not a full script but it should help you do what you want.Dim Act : Set Act = CreateObject("Wscript.shell") Dim StrUser : StrUser = Act.ExpandEnvironmentStrings("%UserName%") Dim StrPass StrPass = InputBox("Type in the password","Password") If StrPass <> "" Then MsgBox "User Type In : " & StrPass & vbCrLf &_ "User Name : " & StrUser, 0 + 32 + 4096, "Password" Else MsgBox "Nothing was type in preparing to quit", 0 + 32 + 4096, "No Text Detected" End If
Beta4Me Posted October 7, 2006 Author Posted October 7, 2006 (edited) This is not a full script but it should help you do what you want.Dim Act : Set Act = CreateObject("Wscript.shell") Dim StrUser : StrUser = Act.ExpandEnvironmentStrings("%UserName%") Dim StrPass StrPass = InputBox("Type in the password","Password") If StrPass <> "" Then MsgBox "User Type In : " & StrPass & vbCrLf &_ "User Name : " & StrUser, 0 + 32 + 4096, "Password" Else MsgBox "Nothing was type in preparing to quit", 0 + 32 + 4096, "No Text Detected" End IfThanks, but that is not what i need. I guess i wasn't specific enough. Please Let me explain everyting:I used the file Yzowl and GSM put together and tweaked it. Then i made this file:@echo OffTITLE User Account CreationECHO Create Desired amount of User Accounts with aECHO set Username and Password that Never Expires.:USERECHO.ECHO.ECHO Type in Username and Password for AccountECHO Note: Case-SensitiveECHO.SET /P USERNAME=Username:SET /P PASS=Password:ECHO.ECHO Your input was...ECHO Username: %USERNAME%ECHO Password: %PASS%ECHO Type in YES to Change it or NO to Confirm.:CHANGESET /P CHANGE=Change:IF /I "%CHANGE%"=="YES" goto :USERIF /I "%CHANGE%"=="Y" goto :USERIF /I "%CHANGE%"=="NO" goto :GROUPIF /I "%CHANGE%"=="N" goto :GROUPECHO Error! Please Try again (Yes/No)...goto :CHANGE:GROUPECHO.ECHO Please Specify account User Privelages...ECHO Note that:ECHO 1 = AdministratorsECHO 2 = UsersECHO 3 = GuestsSET /P GROUP=Group:IF /I "%GROUP%"=="1" SET GROUP=AdministratorsIF /I "%GROUP%"=="2" SET GROUP=UsersIF /I "%GROUP%"=="3" SET GROUP=Guestsgoto :FINALISE:FINALISEclsECHO.ECHO The Account you will create has theECHO following attributes:ECHO.ECHO Username: %USERNAME%ECHO Password: %PASS%ECHO Group: %GROUP%ECHO.:CHANGE1ECHO Type in YES to Change it or NO to Confirm.SET /P CHANGE1=Change:IF /I "%CHANGE1%"=="YES" goto :USERIF /I "%CHANGE1%"=="Y" goto :USERIF /I "%CHANGE1%"=="NO" goto :CREATIONIF /I "%CHANGE1%"=="N" goto :CREATIONECHO Error! Please Try again (Yes/No)...goto :CHANGE1:CREATIONECHO.ECHO Creating %USERNAME%'s Account...net user %USERNAME% %PASS% /addnet localgroup %GROUP% %USERNAME% /addnet accounts /maxpwage:unlimitedclsECHO Task Completed Successfullygoto :CHOICE:CHOICEclsECHO Do you want to Create any more User Accounts?ECHO Type in YES to create more or NO to ExitSET /P CREATION=Change:IF /I "%CREATION%"=="YES" goto :USERIF /I "%CREATION%"=="Y" goto :USERIF /I "%CREATION%"=="NO" goto :ENDIF /I "%CREATION%"=="N" goto :END:ENDECHO.SET /P END=Press Enter to Exit...exitI then decided I wanted it in the same style as the HTA.So i modded it like this:<!-- ORIGINAL HTA AND SCRIPT BY YZOWL HTA EDIT BY GUNSMOKINGMAN HTA RE-EDIT BY BETA4ME --><HTML><HEAD> <TITLE>User Account Creation</TITLE> <HTA:APPLICATION applicationname="User Account Creation" maximizebutton="no" minimizebutton="yes" scroll="no" showintaskbar="yes" singleinstance="yes" Icon="%SystemRoot%\explorer.exe"> <STYLE type="text/css"> Body { font:10.75pt; font-family: arial, Verdana, Palatino Linotype; color:#E3E3E3; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#00CC00', EndColorStr='#4E4E4E'); padding-top:1; padding-bottom:1; Text-Align:; } .Button { font: 8.25pt; font-family: Verdana, Palatino Linotype; color:#E1E1E1; font-weight:bold; Text-Align:Center; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#d0d0d0',endColorStr='#008C80'); padding-top:1; padding-bottom:1; cursor:Hand; Height:19; width:93; border-left: 1px Transparent; border-right: 2px Transparent; border-top: 1px Transparent; border-Bottom: 2px Transparent; } .TextBackGround { font-family: arial, Verdana, Palatino Linotype; color:#1E1E1E; font-weight:bold; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=#e2ded8,EndColorStr=#e8e2de; padding-top:1; padding-bottom:1; border-left: 3px none Transparent; border-right: 2px none Transparent; border-top: 3px none Transparent; border-Bottom: 2px none Transparent;; font-style:normal; font-variant:normal; font-size:8.25pt } </STYLE> <script Language="JavaScript"> var Act = new ActiveXObject("Wscript.Shell"); var Fso = new ActiveXObject("Scripting.FileSystemObject"); /* CLOSE THE HTA -> */ function ExitThis() { window.close();} /* RUN BUTTON CHANGE TEXT -> */ function Button1ChangeText() { if (Run_Button.value =="Submit Data") {Run_Button.value ='Press To Add' Txt1.innerHTML= 'All Three Text Boxes Must Be Filled In. <BR>If Any ' + 'Text Box Is Not Filled In It Will Not <BR>Run The Script!' } else {Run_Button.value ='Submit Data', Txt1.innerHTML= '';}} /* CLEAR BUTTON CHANGE TEXT -> */ function Button2ChangeText() { if (Clear_Button.value =="Clear Text") {Clear_Button.value ='Clear Text'} else {Clear_Button.value ='Clear Text';}} /* CLOSE BUTTON CHANGE TEXT -> */ function Button3ChangeText() { if (Close_Button.value =="Close App") {Close_Button.value ='Close App'} else {Close_Button.value ='Close App';}} </SCRIPT> <script language="VBScript"> Dim strPass, strName, strGroup'/-> TEXT BOXES SCRIPTS Function RegEdit() strName = TextBox0.Value : strPass = TextBox1.Value : strGroup = TextBox2.Value If strName = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Username" & chr(34) document.getElementByID("textbox0").select ElseIf strPass = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Password" & chr(34),64,"Alert" document.getElementByID("textbox1").select ElseIf strGroup = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Group" & chr(34),64,"Alert" document.getElementByID("textbox2").select '/-> START SCRIPT Else Set strScript = Fso.CreateTextFile("CreateUser.vbs") strScript.WriteLine "Set Act = CreateObject(" & chr(34) & "WScript.Shell" & chr(34) & ")" strScript.WriteLine "Set Fso = CreateObject(" & chr(34) & "Scripting.FileSystemObject" & chr(34) & ")" '/-> BODY of SCRIPT strScript.WriteLine "Fso.DeleteFile(WScript.ScriptFullName)" strScript.Close call RunScript End If End Function '/-> FINISH SCRIPT '/-> RUN NEW SCRIPT AND THEN DELETE THE SCRIPT Function RunScript() : Act.Run("CreateUser.vbs"), 1, True : End Function '/-> CLEAR THE TEXT BOXES Function ClearText() : TextBox0.Value = "" : TextBox1.Value = "" : TextBox2.Value = "" : End Function '/-> ON LOAD EVENT Function window_Onload() : window.ResizeTo 440,260 : TextBox0.focus() : End Function </SCRIPT> </HEAD><BODY><CENTER> <!-- TEXT BOX TABLE START --><TABLE width='90%' border='1' cellpadding='6'><TD> <!-- TEXT BOX 01 START --> <TABLE><TD Width='125'><B>» Username</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox0"> </TD></TABLE> <!-- TEXT BOX 02 START --> <TABLE><TD Width='125'><B>» Password</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox1"> </TD></TABLE> <!-- TEXT BOX 03 START --> <TABLE><TD Width='125'><B>» Group</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox2"></TD> </TABLE></TD> <!-- TEXT BOX TABLE END --></TABLE> <p style="margin-top: 0; margin-bottom: 0"> </p> <!-- BUTTON TABLE START --><TABLE> <!-- RUN BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Submit Data" name="Run_Button" OnMouseOver="Button1ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button1ChangeText(),this.style.color='#E1E1E1';" onClick="RegEdit()"></TD> <!-- CLEAR BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Clear Text" name="Clear_Button" OnMouseOver="Button2ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button2ChangeText(),this.style.color='#E1E1E1';" onClick="ClearText()"></TD> <!-- CLOSE BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Close App" name="Close_Button" OnMouseOver="Button3ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button3ChangeText(),this.style.color='#E1E1E1';" onClick="ExitThis()"></TD> <!-- BUTTON TABLE END --> </TABLE></CENTER> <!-- Yzöwl TABLE START --> <TABLE><TD WIDTH='236' HEIGHT='47' Style='font:8.75pt;Color:"#E1E1E1"'><SPAN ID='Txt1'></SPAN></TD> <TD><FONT color="#E1E1E1" size="1.25">© 2006 Yzöwl. All Rights Reserved</FONT></TD></TABLE> <!-- Yzöwl TABLE END --> </BODY></HTML>The section in Red, is another section of the Script i Edited (more like purged) and doesn't work. I need the CMD section that is in Red to be converted to VBS to put in (i think). Substituting %USERNAME% with strUser, %PASS% with strPass, and %GROUP% with strGroup.Thanks peeps for all your help, . Edited October 8, 2006 by mandrake10
gunsmokingman Posted October 7, 2006 Posted October 7, 2006 (edited) I made this hta that adds user pass password and groups.The Thread This is what it looks likeThe Hta Link To Down LoadHere is a re edit VBS script for the hta that does what you ask for add it to your HTADim IntC, strPass, strName, strGroup'/-> TEXT BOXES SCRIPTS Function RegEdit() strName = TextBox0.Value : strPass = TextBox1.Value : strGroup = TextBox2.Value If strName = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Username" & chr(34) document.getElementByID("textbox0").select Else IntC = 1 End If If strPass = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Password" & chr(34),64,"Alert" document.getElementByID("textbox1").select Else IntC = IntC + 1 End If If strGroup = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Group" & chr(34),64,"Alert" document.getElementByID("textbox2").select Else IntC = IntC + 1 End If '/-> THIS IS A CHECK IT WILL ONLY GOTO MAKESCRIPT() IF IT EQUALS 3 If IntC = 3 Then MakeScript() End If End Function '/-> Function MakeScript()'/-> START SCRIPT window.alert("Preparing To Make The script") Set strScript = Fso.CreateTextFile("CreateUser.vbs") strScript.WriteLine "Set Act = CreateObject(" & chr(34) & "WScript.Shell" & chr(34) & ")" strScript.WriteLine "Set Fso = CreateObject(" & chr(34) & "Scripting.FileSystemObject" & chr(34) & ")" '/-> BODY of SCRIPT strScript.WriteLine "Fso.DeleteFile(WScript.ScriptFullName)" strScript.Close call RunScript End Function Edited October 7, 2006 by gunsmokingman
Beta4Me Posted October 8, 2006 Author Posted October 8, 2006 Thanks put it only display a Msg Box saying "Preparing Script" what i need it to do is take the Red stuff in the CMD and put it in the Red section in the HTA. But substituting the Variable names. Thanks, later days, .
gunsmokingman Posted October 8, 2006 Posted October 8, 2006 Thanks put it only display a Msg Box saying "Preparing Script" what i need it to do is take the Red stuff in the CMD and put it in the Red section in the HTA. But substituting the Variable names. Thanks, later days, .It only displays that message if all 3 boxes are filled in. Try to get it to work without all 3 boxes filled in. It will pass all the varibles to MakeScript() you have to fill in that part of the script.
Beta4Me Posted October 8, 2006 Author Posted October 8, 2006 Thanks put it only display a Msg Box saying "Preparing Script" what i need it to do is take the Red stuff in the CMD and put it in the Red section in the HTA. But substituting the Variable names. Thanks, later days, .It only displays that message if all 3 boxes are filled in. Try to get it to work without all 3 boxes filled in. It will pass all the varibles to MakeScript() you have to fill in that part of the script.Sorry but I don't understand . All i want is someone to convert the Red part in CMD to a VBScript so I can use it.
Yzöwl Posted October 8, 2006 Posted October 8, 2006 Not an answer to your latest question, but more of an example Windows NT Command Script, (batch file), which answers the original question and relates it to your current problem(s). The script may look rather long, but it does attempt to cover some error trapping which most people appear to usually ignore.AddUsers.cmd@ECHO OFF&SETLOCAL ENABLEEXTENSIONS&MODE 70,8&COLOR 4FTITLE Account CreationSET /P "TOADD= WOULD YOU LIKE TO ADD ADDITIONAL USERS (Y/N)? "IF /I '%TOADD:~0,1% NEQ 'Y (ENDLOCAL&GOTO :EOF)SET REGKEY="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"SET "CNT1=0"CLS&TITLE Account NameECHO/ NOTE &ECHO/ ¯¯¯¯&ECHO/ECHO/ The First User added will be set as your Default User&ECHO/ECHO/ It will have Administrator Account privileges&ECHO/&CLS:ADDNAMEFOR %%? IN (NAME TIPE UTYPE PASS) DO (SET %%?=)ECHO/ PLEASE ENTER YOUR CHOSEN ACCOUNT (LOGIN) NAMESET /P "NAME="IF "%NAME%" EQU "" (CLS&ECHO/ Blank Names are not accepted! PING -n 4 LOCALHOST >NUL&CLS&GOTO ADDNAME)CLS&ECHO/&ECHO/ THE ACCOUNT NAME YOU HAVE CHOSEN IS&ECHO/&ECHO/ %NAME%&ECHO/ECHO/ WOULD YOU LIKE TO CHANGE IT (Y/N)?SET /P "ANSR="IF /I '%ANSR:~0,1% NEQ 'N (CLS& GOTO ADDNAME)NET USER |FIND /I " %NAME% " >NUL 2>&1 &&(CLS&ECHO/ ECHO/ USER %NAME% ALREADY EXISTS&ECHO/&ECHO/ PLEASE TRY AGAIN&ECHO/ PING -n 4 LOCALHOST >NUL&CLS&GOTO ADDNAME)CLS&TITLE Account TypeIF %CNT1% EQU 0 (SET "UTYPE=Administrator"&CLS&TITLE Account Password GOTO ADDPASS):ADDTYPEECHO/ YOU CAN NOW CHOOSE AN ACCOUNT TYPE FOR %NAME%&ECHO/&ECHO/ Account TypesECHO/ ¯¯¯¯¯¯¯¯¯¯¯¯¯&ECHO/&ECHO/ 1. Computer Administrator (less secure)ECHO/ Has unrestricted access to the computer&ECHO/ECHO/ 2. Power User (more secure)ECHO/ Has only some restricted access to the computer&ECHO/ECHO/ 3. Normal User (recommended)&ECHO/ Has restricted access to the computerECHO/SET /P "TIPE= Please enter your an account type for %NAME% (1/2/3): "SET "TIPE=%TIPE:~0,1%"ECHO/%TIPE% |FINDSTR/R "[1-3]" >NUL ||(CLS&GOTO ADDTYPE)IF %TIPE% LSS 2 (SET UTYPE=Administrator)IF %TIPE% EQU 2 (SET UTYPE=Power User)IF %TIPE% GTR 2 (SET UTYPE=User)CLS&ECHO/&ECHO/ THE ACCOUNT TYPE YOU HAVE CHOSEN IS&ECHO/&ECHO/ %UTYPE%&ECHO/ECHO/ WOULD YOU LIKE TO CHANGE IT (Y/N)?SET /P "ANSR="IF /I '%ANSR:~0,1% NEQ 'N (CLS&GOTO ADDTYPE)CLS&TITLE Account Password:ADDPASSECHO/ PLEASE ENTER A PASSWORD FOR %NAME%&ECHO/&ECHO/ NOTE&ECHO/ ¯¯¯¯&ECHO/ECHO/ Passwords MUST contain a minimum of 6 characters&ECHO/SET /P "PASS="IF "%PASS%" EQU "" (CLS&ECHO/&ECHO/ Blank Passwords are not accepted!&ECHO/ PING -n 4 LOCALHOST >NUL&CLS&GOTO ADDPASS)ECHO/%PASS%|FINDSTR/R "[^a-z,0-9,_,-]" >NUL &&(CLS&ECHO/ ECHO/ Some of the characters you used were not acceptable!&ECHO/ PING -n 4 LOCALHOST >NUL&CLS&GOTO ADDPASS)CLS&ECHO/&ECHO/ THE PASSWORD YOU HAVE CHOSEN FOR %NAME% IS&ECHO/&ECHO/ %PASS%ECHO/&ECHO/ WOULD YOU LIKE TO CHANGE IT (Y/N)?SET /P "ANSR="IF /I '%ANSR:~0,1% NEQ 'N (CLS&GOTO ADDPASS)SET "CNT2=0":LOOPSET /A "CNT2+=1"CALL SET V=%%PASS:~0,%CNT2%%%IF "%V%" NEQ "%PASS%" (GOTO LOOP)IF %CNT2% LSS 6 (CLS&ECHO/ Minimum Password length is 6 characters&ECHO/ ECHO/ Please try again!&ECHO/&PING -n 4 LOCALHOST >NUL&CLS&GOTO ADDPASS)CLS&TITLE Adding AccountNET USER "%NAME%" "%PASS%" /addNET LOCALGROUP "%UTYPE%s" "%NAME%" /addIF %CNT1% EQU 0 (CLS&CALL :DEFLOG)CLS&SET /P "ADDMORE= WOULD YOU LIKE TO ADD ANOTHER USER (Y/N)? "IF /I '%ADDMORE:~0,1% EQU 'Y (SET /A "CNT1+=1"&CLS&TITLE Account Name GOTO ADDNAME)CLS&ECHO/&ECHO/ FINISHED ADDING USERS&ECHO/ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯&ECHO/NET ACCOUNTS /maxpwage:unlimitedPING -n 4 LOCALHOST >NUL&ENDLOCAL&GOTO :EOF:DEFLOGREG ADD %REGKEY% /V DefaultUserName /D "%NAME%" /F >NULREG ADD %REGKEY% /V DefaultPassword /D "%PASS%" /F >NULSET /P "AUTLOG= Would you like %NAME%s Account to Logon Automatically (Y/N)? "IF /I '%AUTLOG:~0,1% EQU 'Y (REG ADD %REGKEY% /V AutoAdminLogon /D 1 /F >NUL)GOTO :EOF
gunsmokingman Posted October 8, 2006 Posted October 8, 2006 (edited) I have add what you needed to this hta. 1:\ I have added a check for the password length if the password is less the six characters then it will not accept that password.'/-> CHECK THE LENGTH OF THE PASSWORD Length = 6 If Length <= Len(strPass) Then IntC = IntC + 1 Else window.alert("This password was not long enough " & strPass & vbcrlf &_ "This has only " & Len(strPass) & " characters the password needs at lest 6 characters") TextBox1.Value = "" Exit Function End If2:\ Added A Confirm Before Adding Information'/-> START CONFIRM ZZ1 = window.confirm("Is This The Correct Information" & vbcrlf &_ "Ok To Add This Information" & vbcrlf & "Cancel to not add the information" & vbcrlf &_ "strPass = " & strPass & vbcrlf & "strName = " & strName & vbcrlf & "strGroup = " & strGroup) If ZZ1 = True Then '/-> ADD THE INFORMATION'/-> REMOVE THESE ' FROM BELOW HERE TO MAKE ACTIVE ' Act.Run("%Comspec% /C net user %" & strName & "% %" & strPass & "% /add"), 0, True' Act.Run("%Comspec% /C net localgroup %" & strGroup & "% %" & strName & " /add"), 0, True' Act.Run("%Comspec% /C net accounts /maxpwage:unlimited"), 0, True Else ClearText() End IFYou will have to edit the VBS script part as I have left it comment out the add user' Act.Run("%Comspec% /C net user %" & strName & "% %" & strPass & "% /add"), 0, True' Act.Run("%Comspec% /C net localgroup %" strGroup "% %" & strName & " /add"), 0, True' Act.Run("%Comspec% /C net accounts /maxpwage:unlimited"), 0, TrueSave As AddUser.hta<!-- ORIGINAL HTA AND SCRIPT BY YZOWL HTA EDIT BY GUNSMOKINGMAN HTA RE-EDIT BY BETA4ME --><HTML><HEAD> <TITLE>User Account Creation</TITLE> <HTA:APPLICATION applicationname="User Account Creation" maximizebutton="no" minimizebutton="yes" scroll="no" showintaskbar="yes" singleinstance="yes" Icon="%SystemRoot%\explorer.exe"> <STYLE type="text/css"> Body { font:10.75pt; font-family: arial, Verdana, Palatino Linotype; color:#E3E3E3; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#00CC00', EndColorStr='#4E4E4E'); padding-top:1; padding-bottom:1; Text-Align:; } .Button { font: 8.25pt; font-family: Verdana, Palatino Linotype; color:#E1E1E1; font-weight:bold; Text-Align:Center; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#d0d0d0',endColorStr='#008C80'); padding-top:1; padding-bottom:1; cursor:Hand; Height:19; width:93; border-left: 1px Transparent; border-right: 2px Transparent; border-top: 1px Transparent; border-Bottom: 2px Transparent; } .TextBackGround { font-family: arial, Verdana, Palatino Linotype; color:#1E1E1E; font-weight:bold; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=#e2ded8,EndColorStr=#e8e2de; padding-top:1; padding-bottom:1; border-left: 3px none Transparent; border-right: 2px none Transparent; border-top: 3px none Transparent; border-Bottom: 2px none Transparent; font-style:normal; font-variant:normal; font-size:8.25pt }</STYLE> <script Language="JavaScript"> var Act = new ActiveXObject("Wscript.Shell"); var Fso = new ActiveXObject("Scripting.FileSystemObject"); /* CLOSE THE HTA -> */ function ExitThis() { window.close();} /* RUN BUTTON CHANGE TEXT -> */ function Button1ChangeText() { if (Run_Button.value =="Submit Data") {Run_Button.value ='Press To Add' Txt1.innerHTML= 'All Three Text Boxes Must Be Filled In. <BR>If Any ' + 'Text Box Is Not Filled In It Will Not <BR>Run The Script!' } else {Run_Button.value ='Submit Data', Txt1.innerHTML= '';}} /* CLEAR BUTTON CHANGE TEXT -> */ function Button2ChangeText() { if (Clear_Button.value =="Clear Text") {Clear_Button.value ='Clear Text'} else {Clear_Button.value ='Clear Text';}} /* CLOSE BUTTON CHANGE TEXT -> */ function Button3ChangeText() { if (Close_Button.value =="Close App") {Close_Button.value ='Close App'} else {Close_Button.value ='Close App';}} </SCRIPT> <script language="VBScript"> Dim IntC, Length, strPass, strName, strGroup, ZZ1'/-> TEXT BOXES SCRIPTS Function RegEdit() strName = TextBox0.Value : strPass = TextBox1.Value : strGroup = TextBox2.Value If strName = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Username" & chr(34) Exit Function Else IntC = 1 End If If strPass = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Password" & chr(34),64,"Alert" Exit Function Else'/-> CHECK THE LENGTH OF THE PASSWORD Length = 6 If Length <= Len(strPass) Then IntC = IntC + 1 Else window.alert("This password was not long enough " & strPass & vbcrlf &_ "This has only " & Len(strPass) & " characters the password needs at lest 6 characters") TextBox1.Value = "" Exit Function End If End If If strGroup = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Group" & chr(34),64,"Alert" Exit Function Else IntC = IntC + 1 End If '/-> THIS IS A CHECK IT WILL ONLY GOTO AddUserFunction() IF IT EQUALS 3 If IntC = 3 Then AddUserFunction() End If End Function Function AddUserFunction()'/-> START CONFIRM ZZ1 = window.confirm("Is This The Correct Information" & vbcrlf &_ "Ok To Add This Information" & vbcrlf & "Cancel to not add the information" & vbcrlf &_ "strPass = " & strPass & vbcrlf & "strName = " & strName & vbcrlf & "strGroup = " & strGroup) If ZZ1 = True Then '/-> ADD THE INFORMATION'/-> REMOVE THESE ' FROM BELOW HERE TO MAKE ACTIVE ' Act.Run("%Comspec% /C net user %" & strName & "% %" & strPass & "% /add"), 0, True' Act.Run("%Comspec% /C net localgroup %" & strGroup & "% %" & strName & " /add"), 0, True' Act.Run("%Comspec% /C net accounts /maxpwage:unlimited"), 0, True Else ClearText() End IF End Function'/-> CLEAR THE TEXT BOXES Function ClearText() TextBox0.Value = "" : TextBox1.Value = "" : TextBox2.Value = "" IntC = 0 End Function'/-> ON LOAD EVENT Function window_Onload() : window.ResizeTo 440,260 : TextBox0.focus() : End Function </SCRIPT> </HEAD><BODY><CENTER><!-- TEXT BOX TABLE START --><TABLE width='95%' border='1' cellpadding='6'><TD><!-- TEXT BOX 01 START --> <TABLE><TD Width='125'><B>» Username</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox0"> </TD></TABLE> <!-- TEXT BOX 02 START --> <TABLE><TD Width='125'><B>» Password</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox1"> </TD></TABLE><!-- TEXT BOX 03 START --> <TABLE><TD Width='125'><B>» Group</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox2"></TD> </TABLE></TD><!-- TEXT BOX TABLE END --></TABLE><p style="margin-top: 0; margin-bottom: 0"> </p><!-- BUTTON TABLE START --><TABLE><!-- RUN BUTTON START --> <TD Width='155' Align='Center'><Input type="button" Class='Button' Value="Submit Data" name="Run_Button" OnMouseOver="Button1ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button1ChangeText(),this.style.color='#E1E1E1';" onClick="RegEdit()"></TD><!-- CLEAR BUTTON START --> <TD Width='155' Align='Center'><Input type="button" Class='Button' Value="Clear Text" name="Clear_Button" OnMouseOver="Button2ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button2ChangeText(),this.style.color='#E1E1E1';" onClick="ClearText()"></TD> <!-- CLOSE BUTTON START --> <TD Width='155' Align='Center'><Input type="button" Class='Button' Value="Close App" name="Close_Button" OnMouseOver="Button3ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button3ChangeText(),this.style.color='#E1E1E1';" onClick="ExitThis()"></TD> <!-- BUTTON TABLE END --> </TABLE></CENTER><!-- Yzöwl TABLE START --> <TABLE><TD WIDTH='236' HEIGHT='47' Style='font:8.75pt;Color:"#E1E1E1"'><SPAN ID='Txt1'></SPAN></TD> <TD><FONT color="#E1E1E1" size="1.25">© 2006 Yzöwl. All Rights Reserved</FONT></TD></TABLE><!-- Yzöwl TABLE END --> </BODY></HTML>I have fixed the line that was causing the problem. Edited October 9, 2006 by gunsmokingman
Beta4Me Posted October 9, 2006 Author Posted October 9, 2006 Thanks for all your help Yzowl & Gsm. Now here's my script:<!-- ORIGINAL HTA AND SCRIPT BY YZOWL HTA EDIT BY GUNSMOKINGMAN HTA RE-EDIT BY BETA4ME --><HTML><HEAD> <TITLE>User Account Creation</TITLE> <HTA:APPLICATION applicationname="User Account Creation" maximizebutton="no" minimizebutton="yes" scroll="no" showintaskbar="yes" singleinstance="yes" Icon="%SystemRoot%\explorer.exe"> <STYLE type="text/css"> Body { font:10.75pt; font-family: arial, Verdana, Palatino Linotype; color:#E3E3E3; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#00CC00', EndColorStr='#4E4E4E'); padding-top:1; padding-bottom:1; Text-Align:; } .Button { font: 8.25pt; font-family: Verdana, Palatino Linotype; color:#E1E1E1; font-weight:bold; Text-Align:Center; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr='#d0d0d0',endColorStr='#008C80'); padding-top:1; padding-bottom:1; cursor:Hand; Height:19; width:93; border-left: 1px Transparent; border-right: 2px Transparent; border-top: 1px Transparent; border-Bottom: 2px Transparent; } .TextBackGround { font-family: arial, Verdana, Palatino Linotype; color:#1E1E1E; font-weight:bold; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0,StartColorStr=#e2ded8,EndColorStr=#e8e2de; padding-top:1; padding-bottom:1; border-left: 3px none Transparent; border-right: 2px none Transparent; border-top: 3px none Transparent; border-Bottom: 2px none Transparent; font-style:normal; font-variant:normal; font-size:8.25pt }</STYLE> <script Language="JavaScript"> var Act = new ActiveXObject("Wscript.Shell"); var Fso = new ActiveXObject("Scripting.FileSystemObject"); /* CLOSE THE HTA -> */ function ExitThis() { window.close();} /* RUN BUTTON CHANGE TEXT -> */ function Button1ChangeText() { if (Run_Button.value =="Submit Data") {Run_Button.value ='Press To Add' Txt1.innerHTML= 'All Three Text Boxes Must Be Filled In. <BR>If Any ' + 'Text Box Is Not Filled In It Will Not <BR>Run The Script!' } else {Run_Button.value ='Submit Data', Txt1.innerHTML= '';}} /* CLEAR BUTTON CHANGE TEXT -> */ function Button2ChangeText() { if (Clear_Button.value =="Clear Text") {Clear_Button.value ='Clear Text'} else {Clear_Button.value ='Clear Text';}} /* CLOSE BUTTON CHANGE TEXT -> */ function Button3ChangeText() { if (Close_Button.value =="Close App") {Close_Button.value ='Close App'} else {Close_Button.value ='Close App';}} </SCRIPT> <script language="VBScript"> Dim IntC, Length, strPass, strName, strGroup, ZZ1'/-> TEXT BOXES SCRIPTS Function RegEdit() strName = TextBox0.Value : strPass = TextBox1.Value : strGroup = TextBox2.Value If strName = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Username" & chr(34) Exit Function Else IntC = 1 End If If strPass = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Password" & chr(34),64,"Alert" Exit Function Else'/-> CHECK THE LENGTH OF THE PASSWORD Length = 6 If Length <= Len(strPass) Then IntC = IntC + 1 Else window.alert("This password was not long enough " & strPass & vbcrlf &_ "This has only " & Len(strPass) & " characters the password needs at lest 6 characters") TextBox1.Value = "" Exit Function End If End If If strGroup = "" Then window.alert "Alert" & vbcrlf & "You need to fill in " & chr(34) & "Group" & chr(34),64,"Alert" Exit Function Else IntC = IntC + 1 End If '/-> THIS IS A CHECK IT WILL ONLY GOTO AddUserFunction() IF IT EQUALS 3 If IntC = 3 Then AddUserFunction() End If End Function Function AddUserFunction()'/-> START CONFIRM ZZ1 = window.confirm("Is This The Correct Information" & vbcrlf &_ "Ok To Add This Information" & vbcrlf & "Cancel to not add the information" & vbcrlf &_ "strPass = " & strPass & vbcrlf & "strName = " & strName & vbcrlf & "strGroup = " & strGroup) If ZZ1 = True Then'/-> ADD THE INFORMATION'/-> REMOVE THESE ' FROM BELOW HERE TO MAKE ACTIVE Act.Run("%Comspec% /C net user %" & strName & "% %" & strPass & "% /add"), 0, True Act.Run("%Comspec% /C net localgroup %" strGroup "% %" & strName & " /add"), 0, True Act.Run("%Comspec% /C net accounts /maxpwage:unlimited"), 0, True Else ClearText() End IF End Function'/-> CLEAR THE TEXT BOXES Function ClearText() TextBox0.Value = "" : TextBox1.Value = "" : TextBox2.Value = "" IntC = 0 End Function'/-> ON LOAD EVENT Function window_Onload() : window.ResizeTo 440,260 : TextBox0.focus() : End Function </SCRIPT> </HEAD><BODY><CENTER><!-- TEXT BOX TABLE START --><TABLE width='95%' border='1' cellpadding='6'><TD><!-- TEXT BOX 01 START --> <TABLE><TD Width='125'><B>» Username</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox0"> </TD></TABLE> <!-- TEXT BOX 02 START --> <TABLE><TD Width='125'><B>» Password</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox1"> </TD></TABLE><!-- TEXT BOX 03 START --> <TABLE><TD Width='125'><B>» Group</TD><TD> :</B></TD> <TD colspan="2"><Input type="text" Class='TextBackGround' size="36" name="textbox2"></TD> </TABLE></TD><!-- TEXT BOX TABLE END --></TABLE><p style="margin-top: 0; margin-bottom: 0"> </p><!-- BUTTON TABLE START --><p style="margin-top: 0; margin-bottom: 0"> </p><TABLE><!-- RUN BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Submit Data" name="Run_Button" OnMouseOver="Button1ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button1ChangeText(),this.style.color='#E1E1E1';" onClick="RegEdit()"></TD><!-- CLEAR BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Clear Text" name="Clear_Button" OnMouseOver="Button2ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button2ChangeText(),this.style.color='#E1E1E1';" onClick="ClearText()"></TD> <!-- CLOSE BUTTON START --> <TD Width='125' Align='Center'><Input type="button" Class='Button' Value="Close App" name="Close_Button" OnMouseOver="Button3ChangeText(),this.style.color='#004f1a';" OnMouseOut="Button3ChangeText(),this.style.color='#E1E1E1';" onClick="ExitThis()"></TD> <!-- BUTTON TABLE END --> </TABLE></CENTER><!-- Yzöwl TABLE START --> <TABLE><TD WIDTH='236' HEIGHT='47' Style='font:8.75pt;Color:"#E1E1E1"'><SPAN ID='Txt1'></SPAN></TD> <TD><FONT color="#E1E1E1" size="1.25">© 2006 Yzöwl. All Rights Reserved</FONT></TD></TABLE><!-- Yzöwl TABLE END --> </BODY></HTML>But i get this error:followed by this:(As you can see this is sized wrong).This only happens when I uncomment:Act.Run("%Comspec% /C net user %" & strName & "% %" & strPass & "% /add"), 0, True Act.Run("%Comspec% /C net localgroup %" strGroup "% %" & strName & " /add"), 0, True Act.Run("%Comspec% /C net accounts /maxpwage:unlimited"), 0, TrueAny Ideas?
gunsmokingman Posted October 9, 2006 Posted October 9, 2006 (edited) I missed 2 of these & in One line Change ThisAct.Run("%Comspec% /C net localgroup %" strGroup "% %" & strName & " /add"), 0, TrueChange ToAct.Run("%Comspec% /C net localgroup %" & strGroup & "% %" & strName & " /add"), 0, True Edited October 9, 2006 by gunsmokingman
Beta4Me Posted October 11, 2006 Author Posted October 11, 2006 I missed 2 of these & in One line Change ThisAct.Run("%Comspec% /C net localgroup %" strGroup "% %" & strName & " /add"), 0, TrueChange ToAct.Run("%Comspec% /C net localgroup %" & strGroup & "% %" & strName & " /add"), 0, TrueTY. I fixed the file and they both work like a charm. Thanks for your help, mate!
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