I am currently working in an environment where I am managing 30 servers which are all in workgroups. As this new project kicks off I am being asked with increasing frequency to create accounts on these servers. I decided that the best way to do this would be to automate the process using VB script. I ran a script to create a basic account which works fine but when I have tried to implement the same script using an hta page the results never get passed through. Could somebody please take a quick glance and point me in the right direction:
Here is the code:
<HEAD>
<TITLE>Create Local User Account</TITLE>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Drop Down"
BORDER="Dialog"
CAPTION="Yes"
SCROLL="NO"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="Yes"
WINDOWSTATE="maximize">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">
Sub Window_OnLoad
Window.Server.Focus
End Sub
Sub btn01_OnClick
Dim strSvr
oElements = Window.Server.SelectedIndex
strProduct = Window.Server.Options(oElements).Text
Select Case strSvr
Case "server1"
cmpname = "192.168.0.1"
Case "server2"
cmpname = "192.168.0.2"
Case "server3"
cmpname = "192.168.0.3"
Case "server4"
cmpname = "192.168.0.4"
End Select
Set colaccounts = GetObject("WinNT://" & cmpname)
Set objUser = colaccounts.Create("user",Name)
objUser.SetInfo
objUser.SetPassword "" & strpass
objUser.SetInfo
End Sub
Sub btn02_OnClick
Window.Close
End Sub
</SCRIPT>
<H2>Create A New Account</H2>
<P>Please select the Server:
<SELECT NAME="Server">
<OPTION>server1</OPTION>
<OPTION>server2</OPTION>
<OPTION>server3</OPTION>
<OPTION>server4</OPTION>
</SELECT><P>
Name <br>
<INPUT TYPE="text" NAME="name" SIZE="40" MAXLENGTH="60"><BR>
Password <br>
<INPUT TYPE="text" NAME="strpass" SIZE="40" MAXLENGTH="60"><BR>
Username<br>
<INPUT TYPE="text" NAME="struname" SIZE="40" MAXLENGTH="60"><BR>
<BR>
<BR>
<Input Type = "Button" Name = "btn01" VALUE = "SUBMIT">
<Input Type = "Button" Name = "btn02" VALUE = "CLOSE">
<BR>
<BR>
</BODY>
Thanks for your time
Here is the code:
<HEAD>
<TITLE>Create Local User Account</TITLE>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Drop Down"
BORDER="Dialog"
CAPTION="Yes"
SCROLL="NO"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="Yes"
WINDOWSTATE="maximize">
</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">
Sub Window_OnLoad
Window.Server.Focus
End Sub
Sub btn01_OnClick
Dim strSvr
oElements = Window.Server.SelectedIndex
strProduct = Window.Server.Options(oElements).Text
Select Case strSvr
Case "server1"
cmpname = "192.168.0.1"
Case "server2"
cmpname = "192.168.0.2"
Case "server3"
cmpname = "192.168.0.3"
Case "server4"
cmpname = "192.168.0.4"
End Select
Set colaccounts = GetObject("WinNT://" & cmpname)
Set objUser = colaccounts.Create("user",Name)
objUser.SetInfo
objUser.SetPassword "" & strpass
objUser.SetInfo
End Sub
Sub btn02_OnClick
Window.Close
End Sub
</SCRIPT>
<H2>Create A New Account</H2>
<P>Please select the Server:
<SELECT NAME="Server">
<OPTION>server1</OPTION>
<OPTION>server2</OPTION>
<OPTION>server3</OPTION>
<OPTION>server4</OPTION>
</SELECT><P>
Name <br>
<INPUT TYPE="text" NAME="name" SIZE="40" MAXLENGTH="60"><BR>
Password <br>
<INPUT TYPE="text" NAME="strpass" SIZE="40" MAXLENGTH="60"><BR>
Username<br>
<INPUT TYPE="text" NAME="struname" SIZE="40" MAXLENGTH="60"><BR>
<BR>
<BR>
<Input Type = "Button" Name = "btn01" VALUE = "SUBMIT">
<Input Type = "Button" Name = "btn02" VALUE = "CLOSE">
<BR>
<BR>
</BODY>
Thanks for your time