MSFN Forum: Add User Hta - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Add User Hta Rate Topic: -----

#1 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 01 June 2006 - 04:47 PM

Use The Code Below The Image To Make This One
Posted Image

Quote

 
<HEAD><html>
 <HTA:APPLICATION 
   ID="Gsm_UserAdd"	  SCROLL="No" 
   SCROLLFLAT ="No"	 SingleInstance="Yes" 
   ShowInTaskbar="Yes"  SysMenu="Yes" 
   MaximizeButton="No"  MinimizeButton="Yes" 
   Border="Thin"		BORDERSTYLE ="complex" 
   INNERBORDER ="No"	Caption="Yes"
   WindowState="Normal" APPLICATIONNAME="Gsm_UserAdd"
   Icon="%SystemRoot%\explorer.exe">
  <Title>Gsm Add User</Title>
  <!-- BODY STYLE -->
  <STYLE type="text/css">  
	Body.Normal
	{ 
	  font: 10.25pt Verdana;
	  color:#000080;
	  font-weight:bold;
	  filter:progid:DXImageTransform.Microsoft.Gradient
	  (GradientType=0,StartColorStr='#86cceb',endColorStr='#5589ab');
	  padding-top:1;
	  padding-bottom:1;
	  Text-Align:;
	}
	.Txt1
	{ 
	  font: 8.25pt Verdana;
	  color:#000080;
	  font-weight:bold;
	  padding-top:1;
	  padding-bottom:1;
	}
	.Txt2
	{ 
	  font: 8.25pt Verdana;
	  color:#196239;
	  font-weight:bold;
	  padding-top:1;
	  padding-bottom:1;
	}
	Table.Normal
	{ 
	  filter:progid:DXImageTransform.Microsoft.Gradient
	  (GradientType=0,StartColorStr='#E2E2E2',EndColorStr='#9e9e9e');
	  padding-top:1;
	  padding-bottom:1;
	  Text-Align:;
	  vertical-align:;
	}
	.Button
	{ 
	  font: 8.25pt Verdana;
	  color:#E1E1E1;
	  font-weight:bold;
	  filter:progid:DXImageTransform.Microsoft.Gradient
	  (GradientType=0,StartColorStr='#86cceb',endColorStr='#5589ab');
	  padding-top:1;
	  padding-bottom:1;
	  Text-Align:Center;
	  cursor:Hand;
	  Height:21;
	  width:77;
	  border-left: 1px Transparent #6480af;
	  border-right: 2px Transparent #6480af;
	  border-top: 1px Transparent #6480af;
	  border-Bottom: 2px Transparent #6480af;
	}
  </STYLE>
 <!-- RE SIZE THE WINDOW AND PLACE THE WINDOW -->
  <script Language="JavaScript"> 
   window.resizeTo (375,275),window.moveTo (100,125); 
  </SCRIPT>
 <!-- BODY ON LOAD AND LIST BOX -->
  <script language="VBScript"> 
   Dim Act : Set Act = CreateObject("WScript.Shell")
   Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
   Dim Uname : Uname = Act.ExpandEnvironmentStrings("%UserName%")
   Dim DelHta : DelHta = Act.ExpandEnvironmentStrings("%SystemDrive%\UserAdd.Hta")
   Dim strComputer,objGroup, objOption
   Dim A1, A2, A3, CT : CT = 0
   strComputer = Act.ExpandEnvironmentStrings("%ComputerName%")
'/-> MAKES THE LIST OF USER GROUPS   
	Function ComputerGroups()   
	 Set colGroups = GetObject("WinNT://" & strComputer & "") : colGroups.Filter = Array("group")
	 For Each objGroup In colGroups 
	   CT = CT + 1
	  Set objOption = Document.createElement("OPTION")
		objOption.Value = CT 
		objOption.Text = objGroup.Name 
	   If CT = 2 or CT = 4 or CT = 6 or CT = 8 or CT = 10 Then
		objOption.style.backgroundcolor = "#C9C9C9" 
		objOption.style.color = "#3A3A3A" 
	   Else 
		objOption.style.backgroundcolor = "#E9E9E9" 
		objOption.style.color = "#235779" 
	   End If
	  AvailableGroups.Add(objOption)
	 Next
	   GU = Array(OBJGU)
	   Text.innerHTML = Uname & ", did you want to add a new user?"
	End Function 
'/-> GET THE VALUE FROM THE LIST BOX
	Function SelectTheGroup()
	 For Each objOption in AvailableGroups.Options
	  If objOption.Selected Then
		A3 = objOption.InnerText
	  End If
	 Next
	End Function 
  </SCRIPT>
 <!-- --></Head><Body Class='Normal' onLoad='ComputerGroups()'>
 <!-- TOP TEXT --><Center><Table><TD Class='Txt1'><Span ID='Text'> </Span></TD></Table></Center><!-- -->
 <!-- USER NAME -->
  <script language="VBScript">
	Function ClearUserName()
	 document.Forms(0).elements("UserName").value  = ""
	End Function
  </SCRIPT>
  <Table><Form><TD Class='Txt2' Width='80'>User Name</TD><TD>
  <input type=text Size=35 Style='font:8.25pt Verdana;color:#1E1E1E;font-weight:bold;' name='UserName' tabindex=1>
  </TD></Table></Form>
 <!-- PASSWORD -->
  <script language="VBScript">
	Function ClearPassWord()
	 document.Forms(1).elements("PassWord").value  = ""
	End Function
  </SCRIPT>
  <Table><Form><TD Class='Txt2' Width='80'>Password</TD><TD>
  <input type=text Size=35 Style='font:8.25pt Verdana;color:#1E1E1E;font-weight:bold;' name='PassWord' tabindex=2>
  </TD></Table></Form>
 <!-- GROUPS-->
  <Table><TD Class='Txt2' Width='80'>Group</TD><TD>
  <select size='1' name='AvailableGroups' style='width:230'></select></TD></Table>
 <!-- TEXT MESSAGE-->
  <Center><Table><TD Class='Txt2' Height='23'>Select the group name you want to add</TD></Table></Center>
 <!-- START BUTTUN TABLE -->
  <Center><Table Class='Normal'><!-- SPACER --><TD Width='15'></TD><!-- -->
 <!-- ADD USER -->
  <script language="VBScript">
  <!--
'/--> WHERE ALL INPUT INFO GOES TO
	Function UserAdd_OnClick
	 Dim ColGroup,NewUser
	 SelectTheGroup()
	  A1 = document.Forms(0).elements("UserName").value 
	  If A1 = "" Then
	   window.alert Uname & ", there was no name in the inputbox" & "Type in the name in the top inputbox"
	  Exit Function
	 End If 
	 If A1 <> "" Then 
	   window.alert "New User Name = " & A1
	 End If
	  A2 = document.Forms(1).elements("PassWord").value 
	 If A2 = "" Then : window.alert "You Have Select not to add a password to user" : End If 
	 If A2 <> "" Then
	  window.alert "User Password = " & A2
	  End If
	   Set colAccounts = GetObject("WinNT://" & strComputer & "")
	   Set objGroup = GetObject("WinNT://" & strComputer & "/" & A3 & ",group")
	   Set objUser = colAccounts.Create("user", "" & A1 & "")
	   objUser.SetPassword "" & A2 & ""
	   objUser.SetInfo
	   objGroup.Add(objUser.ADsPath)
	  Exit Function
	End Function
  -->
  </SCRIPT>
  <TD><INPUT NAME='UserAdd' TYPE='BUTTON' VALUE='Add User' Class='Button'></TD>
 <!-- SPACER --><TD Width='15'></TD>
 <!-- CLEAR TEXT -->
  <script language="VBScript">
   Function TextClear_OnClick
	 ClearUserName() : ClearPassWord()
   End Function
  </SCRIPT>
  <TD><INPUT NAME='TextClear' TYPE='BUTTON' VALUE='Clear Text' Class='Button'></TD>
 <!-- SPACER --><TD Width='15'></TD>
 <!-- CLOSE HTA BUTTON -->
  <script language="VBScript">
   Function ExitHta_OnClick
	If Fso.FileExists(DelHta) Then Fso.DeleteFile(DelHta) End If 
	window.close()
   End Function 
  </SCRIPT>
 <!-- CLOSE HTA BUTTON -->
  <TD><INPUT NAME='ExitHta' TYPE='BUTTON' VALUE='Close Hta' Class='Button' STyle='color:#ad0000;'></TD>
  <!-- SPACER --><TD Width='15'></TD><!-- --></Table></Center> 

Updated Manage User Tool

This post has been edited by Yzöwl: 29 January 2008 - 02:24 PM
Reason for edit: code tags replaced to improve board formatting



#2 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 02 June 2006 - 12:23 AM

I have made some changes to the hta.
1:\ Added a Delete User Accounts
2:\ Added some poup up text
3:\ Change the way the text input boxes look.
Posted Image

Quote

 
<HEAD><html>
 <HTA:APPLICATION 
   ID="Gsm_UserAdd_V1"  SCROLL="No" 
   SCROLLFLAT ="No"	 SingleInstance="Yes" 
   ShowInTaskbar="Yes"  SysMenu="Yes" 
   MaximizeButton="No"  MinimizeButton="Yes" 
   Border="Thin"		BORDERSTYLE ="complex" 
   INNERBORDER ="No"	Caption="Yes"
   WindowState="Normal" APPLICATIONNAME="Gsm_UserAdd_V1"
   Icon="%SystemRoot%\explorer.exe">
  <Title>Gsm Add User</Title>
  <!-- BODY STYLE -->
  <STYLE type="text/css">  
	Body.Normal
	{ 
	  font: 8.25pt Verdana;
	  color:#000080;
	  font-weight:bold;
	  filter:progid:DXImageTransform.Microsoft.Gradient
	  (GradientType=0,StartColorStr='#86cceb',endColorStr='#5589ab');
	  padding-top:1;
	  padding-bottom:1;
	  Text-Align:;
	}
	.Txt1
	{ 
	  font: 8.25pt Verdana;
	  color:#000080;
	  font-weight:bold;
	  padding-top:1;
	  padding-bottom:1;
	}
	.Txt2
	{ 
	  font: 8.25pt Verdana;
	  color:#196239;
	  font-weight:bold;
	  padding-top:1;
	  padding-bottom:1;
	}
	Table.Normal
	{ 
	  filter:progid:DXImageTransform.Microsoft.Gradient
	  (GradientType=0,StartColorStr='#E2E2E2',EndColorStr='#9e9e9e');
	  padding-top:1;
	  padding-bottom:1;
	  Text-Align:;
	  vertical-align:;
	}
	.Button
	{ 
	  font: 8.25pt Verdana;
	  color:#E1E1E1;
	  font-weight:bold;
	  filter:progid:DXImageTransform.Microsoft.Gradient
	  (GradientType=0,StartColorStr='#86cceb',endColorStr='#5589ab');
	  padding-top:1;
	  padding-bottom:1;
	  Text-Align:Center;
	  cursor:Hand;
	  Height:21;
	  width:77;
	  border-left: 1px Transparent #6480af;
	  border-right: 2px Transparent #6480af;
	  border-top: 1px Transparent #6480af;
	  border-Bottom: 2px Transparent #6480af;
	}
	.TextBackGround
	{
	  font:8.25pt Verdana;
	  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 Solid #75b8d7;
	  border-right: 2px Transparent #6480af;
	  border-top: 3px Solid #75b8d7;
	  border-Bottom: 2px Transparent #6480af;
	}
  </STYLE>
 <!-- RE SIZE THE WINDOW AND PLACE THE WINDOW -->
  <script Language="JavaScript"> 
   window.resizeTo (395,275),window.moveTo (100,125); 
   var Act = new ActiveXObject("Wscript.Shell");  
   var Fso = new ActiveXObject("Scripting.FileSystemObject");
   var objNetwork = new ActiveXObject("Wscript.Network");
   var Uname = Act.ExpandEnvironmentStrings("%UserName%");
// --> 
   // UserName
   function UN() { if (RadBG.style.visibility =="hidden"){RadBG.style.visibility ="",H1a.style.visibility ="" }
   else {RadBG.style.visibility ="hidden",H1a.style.visibility ="hidden";}}
// --> 
   // PassWord
   function PW() { if (RadBG.style.visibility =="hidden"){RadBG.style.visibility ="",H2a.style.visibility ="" 
   H2b.style.visibility =""}else{RadBG.style.visibility ="hidden",H2a.style.visibility ="hidden",H2b.style.visibility ="hidden";}}
// --> 
   // UserGroups
   function UG() { if (RadBG.style.visibility =="hidden"){RadBG.style.visibility ="",H3a.style.visibility ="" 
   H3b.style.visibility =""}else{RadBG.style.visibility ="hidden",H3a.style.visibility ="hidden",H3b.style.visibility ="hidden";}}
// --> 
   // ADD USER BUTTON
   function AddU() { if (RadBG.style.visibility =="hidden"){RadBG.style.visibility ="", H4a.style.visibility =""}
   else {RadBG.style.visibility ="hidden",H4a.style.visibility ="hidden";}}
// --> 
   // DELETE USER BUTTON
   function DelU() { if (RadBG.style.visibility =="hidden"){RadBG.style.visibility ="",H5a.style.visibility ="" 
   H5b.style.visibility =""}else{RadBG.style.visibility ="hidden",H5a.style.visibility ="hidden",H5b.style.visibility ="hidden";}}
  </SCRIPT>
 <!-- BODY ON LOAD AND LIST BOX -->
  <script language="VBScript"> 
   Dim DelHta : DelHta = Act.ExpandEnvironmentStrings("%SystemDrive%\ManageUsers.Hta")
   Dim strComputer,objGroup, objOption
   Dim A1, A2, A3, CT : CT = 0
   strComputer = objNetwork.ComputerName
'/-> MAKES THE LIST OF USER GROUPS   
	Function ComputerGroups()   
	 Set colGroups = GetObject("WinNT://" & strComputer & "") : colGroups.Filter = Array("group")
	 For Each objGroup In colGroups 
	   CT = CT + 1
	  Set objOption = Document.createElement("OPTION")
		objOption.Value = CT 
		objOption.Text = objGroup.Name 
	   If CT = 2 or CT = 4 or CT = 6 or CT = 8 or CT = 10 Then
		objOption.style.backgroundcolor = "#C9C9C9" 
		objOption.style.color = "#3A3A3A" 
	   Else 
		objOption.style.backgroundcolor = "#E9E9E9" 
		objOption.style.color = "#235779" 
	   End If
	  AvailableGroups.Add(objOption)
	 Next
	   GU = Array(OBJGU)
	   Text.innerHTML = Uname & ", did you want to add a new user?"
	End Function 
'/-> GET THE VALUE FROM THE LIST BOX
	Function SelectTheGroup()
	 For Each objOption in AvailableGroups.Options
	  If objOption.Selected Then
		A3 = objOption.InnerText
	  End If
	 Next
	End Function 
  </SCRIPT>
 <!-- --></Head><Body Class='Normal' onLoad='ComputerGroups()'>
 <!-- TOP TEXT --><Center><Table><TD Class='Txt1'><Span ID='Text'> </Span></TD></Table></Center><!-- -->
 <!-- USER NAME -->
  <script language="VBScript">
	Function ClearUserName()
	 document.Forms(0).elements("UserName").value  = ""
	End Function
  </SCRIPT>
  <Table><Form><TD Class='Txt2' Width='80' OnMouseOver="UN('Text')" OnMouseOut="UN('Text')">User Name</TD><TD>
  <input type=text Size=35 Class='TextBackGround' name='UserName' tabindex=1>
  </TD></Table></Form>
 <!-- PASSWORD -->
  <script language="VBScript">
	Function ClearPassWord()
	 document.Forms(1).elements("PassWord").value  = ""
	End Function
  </SCRIPT>
  <Table><Form><TD Class='Txt2' Width='80' OnMouseOver="PW('Text')" OnMouseOut="PW('Text')">Password</TD><TD>
  <input type=text Size=35 Class='TextBackGround' name='PassWord' tabindex=2>
  </TD></Table></Form>
 <!-- GROUPS-->
  <Table><TD Class='Txt2' Width='80' OnMouseOver="UG('Text')" OnMouseOut="UG('Text')">Group</TD><TD>
  <select size='1' name='AvailableGroups' style='width:230'></select></TD></Table>
 <!-- TEXT MESSAGE-->
  <Center><Table><TD Class='Txt2' Height='25'> </TD></Table></Center>
 <!-- START BUTTUN TABLE -->
  <Center><Table Class='Normal'><!-- SPACER --><TD Width='7'></TD><!-- -->
 <!-- ADD USER -->
  <script language="VBScript">
  <!--
'/--> WHERE ALL INPUT INFO GOES TO
	Function UserAdd_OnClick
	 Dim ColGroup,NewUser
	 SelectTheGroup()
	  A1 = document.Forms(0).elements("UserName").value 
	  If A1 = "" Then
	   window.alert Uname & ", there was no name in the inputbox" & "Type in the name in the top inputbox"
	  Exit Function
	 End If 
	 If A1 <> "" Then 
	   window.alert "New User Name = " & A1
	 End If
	  A2 = document.Forms(1).elements("PassWord").value 
	 If A2 = "" Then : window.alert "You Have Select not to add a password to user" : End If 
	 If A2 <> "" Then
	  window.alert "User Password = " & A2
	  End If
	   Set colAccounts = GetObject("WinNT://" & strComputer & "")
	   Set objGroup = GetObject("WinNT://" & strComputer & "/" & A3 & ",group")
	   Set objUser = colAccounts.Create("user", "" & A1 & "")
	   objUser.SetPassword "" & A2 & ""
	   objUser.SetInfo
	   objGroup.Add(objUser.ADsPath)
	  Exit Function
	End Function
  -->
  </SCRIPT>
  <TD OnMouseOver="AddU('Text')" OnMouseOut="AddU('Text')">
  <INPUT NAME='UserAdd' TYPE='BUTTON' VALUE='Add User' Class='Button'></TD>
 <!-- SPACER --><TD Width='7'></TD>
 <!-- CLEAR TEXT -->
  <script language="VBScript">
   Function TextClear_OnClick : ClearUserName() : ClearPassWord() : End Function
  </SCRIPT>
  <TD><INPUT NAME='TextClear' TYPE='BUTTON' VALUE='Clear Text' Class='Button'></TD>
 <!-- SPACER --><TD Width='7'></TD>
 <!-- DELETE USER -->
  <script language="VBScript">
	Function DeleteAUser_OnClick
	 Dim Comp, DelAccounts, LUser, objUser, strUser
	 Set DelAccounts = GetObject("WinNT://" & strComputer & "")
	 DelAccounts.Filter = Array("user")
'/-> ARRAY TO LIST LOCAL USERS	  
	 For Each objUser In DelAccounts
	  LUser = LUser & vbCrLf & "User Name : " & objUser.Name
	 Next
'/-> INPUTBOX THAT HOLDS THE LIST OF USERS
	strUser = InputBox(Space(7) & strComputer & vbCrLf & "Please Type In The User Name That You"_
	 & " Want To Delete From " & strComputer & vbCrLf & LUser ,"Delete User Name",,1600,2200)
	  If strUser = "" Then 
	   window.alert "User has cancel"
	  End If 
	   If strUser <> "" Then 
		Set Comp = GetObject("WinNT://" & strComputer & "")
		Comp.Delete "user", strUser
	   End If 
	  Exit Function
	End Function
  </SCRIPT>
  <TD OnMouseOver="DelU('Text')" OnMouseOut="DelU('Text')">
  <INPUT NAME='DeleteAUser' TYPE='BUTTON' VALUE='Del User' Class='Button' Style='color:#ad0000;'></TD>
  <!-- SPACER --><TD Width='7'></TD>
 <!-- CLOSE HTA BUTTON -->
  <script language="VBScript">
   Function ExitHta_OnClick
	If Fso.FileExists(DelHta) Then Fso.DeleteFile(DelHta) End If 
	window.close()
   End Function 
  </SCRIPT>
  <TD><INPUT NAME='ExitHta' TYPE='BUTTON' VALUE='Close Hta' Class='Button' Style='color:#ad0000;'></TD>
  <!-- SPACER --><TD Width='7'></TD><!-- --></Table></Center>
 <!-- == TRANSPARENT BACK GROUND FOR ALL POPUP TEXT-->
  <Div id="RadBG" style="visibility:hidden; position:absolute; top:0; Left:0; width:1; height:1; 
   background-color: white; filter:progid:DXImageTransform.alpha(opacity=75);
   filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#72aecd', EndColorStr='#72aecd')"></DIV>
 <!-- ========================= ADD USER NAME ========================= -->
  <DIV id="H1a" style="visibility:hidden;color:Blue;position:absolute;top:57;left:10;width:325;height:12;margin-top:1;margin-left:1;">
  <UL Class="Txt1">Type in the new user name to add.<LI>This will add the name to the User Account</Li></UL></DIV>
 <!-- ========================= ADD PASSWORD ========================= -->
  <DIV id="H2a" style="visibility:hidden;color:Green;position:absolute;top:55;left:10;width:325;height:14;margin-top:1;margin-left:1;">
  <UL Class="Txt2" Align=''>Add a password for the new user
  <Li Class='Txt1'>The password does not have to be filled in.</Li></UL></DIV>
  <DIV id="H2b" style="visibility:hidden;color:Blue;position:absolute;top:105;left:10;width:355;height:12;margin-top:1;margin-left:1;">
  <UL Class="Txt1">This will not affect the new user if left empty.</UL></DIV>
 <!-- ========================= ADD GROUP ========================= -->
  <DIV id="H3a" style="visibility:hidden;color:Green;position:absolute;top:110;left:10;width:345;height:14;margin-top:1;margin-left:1;">
  <Div Class="Txt2">Select the group name you want to add the user to.</div></DIV>
  <DIV id="H3b" style="visibility:hidden;color:Blue;position:absolute;top:150;left:10;width:339;height:12;margin-top:1;margin-left:1;">
  <Div Class="Txt1">If nothing is selected it will use the Administrators Group as the defualt group
  to add the new user to.</Div></DIV>
 <!-- ========================= ADD USER BUTTON ========================= -->
  <DIV id="H4a" style="visibility:hidden;color:Blue;position:absolute;top:160;left:5;width:375;height:12;margin-top:1;margin-left:1;">
  <Div Class="Txt1">Press to add the new user account to the local computer</Div></DIV>
 <!-- ========================= DELETE USER BUTTON ========================= -->
  <DIV id="H5a" style="visibility:hidden;color:Green;position:absolute;top:110;left:10;width:345;height:14;margin-top:1;margin-left:1;">
  <Div Class="Txt2">Delete A Local User Account.</div></DIV>
  <DIV id="H5b" style="visibility:hidden;color:Blue;position:absolute;top:150;left:5;width:375;height:12;margin-top:1;margin-left:1;">
  <Div Class="Txt1">This list all the Local User Account that you may want to delete from the Local Computer</Div></DIV> 


Updated Manage User Tool

This post has been edited by Yzöwl: 29 January 2008 - 02:25 PM
Reason for edit: code tags replaced to improve board formatting


#3 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 29 January 2008 - 11:28 AM

I have updated the Manage User Tool, and thank you to those who have tried this.
Posted Image
New Code

Quote

 
 <HEAD>
 <HTML
  xmlns:v='urn:schemas-microsoft-com:vml'
  xmlns:o='urn:schemas-microsoft-com:office:office'
  xmlns:w='urn:schemas-microsoft-com:office:word'
  xmlns='http://www.w3.org/TR/REC-html40'>
 <TITLE>Manage Users</TITLE>
 <HTA:APPLICATION ID='ManageUsers'
  Scroll='No'			 
  SCROLLFLAT ='No'		
  SingleInstance='Yes'
  SysMenu='Yes'
  ShowInTaskBar='No'
  MaximizeButton='No'
  MinimizeButton='No'	 
  Border='Thin'
  BORDERSTYLE ='complex'  
  INNERBORDER ='Yes'
  Caption='Yes'  
  WindowState='Normal'
  APPLICATIONNAME='Manage_Users' 
  Icon='%SystemRoot%\explorer.exe'>
  
 <STYLE Type="text/css">
  Body
   {
	Font-Size:8.05pt;
	Font-Weight:Bold;
	Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
	Color:#001254;
	BackGround-Color:Transparent;
	Filter:progid:DXImageTransform.Microsoft.Gradient
	(StartColorStr='#fdf7f1',endColorStr='#d1cbc5');
	Margin-Top:1;
	Margin-Bottom:1;
	Margin-Left:4;
	Margin-Right:4;
	Padding-Top:1;
	Padding-Bottom:1;
	Padding-Left:4;
	Padding-Right:4;
	Text-Align:Center;
	Vertical-Align:Top;
	Border-Top:2px Solid #a6a29e;
	Border-Bottom:3px Solid #cbc7c3;
	Border-Left:2px Solid #b2aeaa;
	Border-Right:3px Solid #bcb8b4;
   }
  .TextBackGround
  {
	Font-Size:8.05pt;
	Font-Weight:Bold;
	Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
	Color:#1e1e1e;
	filter:progid:DXImageTransform.Microsoft.Gradient
	(StartColorStr='#e2ded8',EndColorStr='#e8e2de;');
	padding-top:1;
	padding-bottom:1;
	Border-left: 2px Solid #75b8d7;
	Border-right: 1px Transparent #6480af;
	Border-top: 2px Solid #75b8d7;
	Border-Bottom: 1px Transparent #6480af;
   }
   
  Select.Bx1
   {
	Font-Size:7.95pt;
	Font-Weight:Bold;
	Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
   }
  BUTTON
   {
	Position:Absolute;Bottom:15;
	Width:85;
	Height:15;
	Cursor:Hand;
	Font-Size:8.05pt;
	Font-Weight:Bold;
	Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
	Color:#001142;
	Filter:progid:DXImageTransform.Microsoft.Gradient
	(StartColorSTR='#bbddff',endColorSTR='#224488');
	Padding-Top:1;
	Padding-Bottom:2;
	Margin-Left:1pt;
	Margin-Right:1pt;
	Border-Top:1px TransParent;
	Border-Bottom:2px TransParent;
	Border-Left:1px TransParent;
	Border-Right:2px TransParent;
   }
 </STYLE>
  <script Language="JavaScript">
  window.resizeTo (385,225),window.moveTo (100,125); 
   var Act = new ActiveXObject("Wscript.Shell");  
   var Fso = new ActiveXObject("Scripting.FileSystemObject");
   var Net = new ActiveXObject("Wscript.Network");
   var Hta = Act.ExpandEnvironmentStrings("%Tmp%\\ManageUsers.hta");
   var StrComputer = Net.ComputerName;
   var CT = 0
   var A1, A2, A3
   window.onload=function()
  {
   Text.innerHTML='Manage Users Utility'
   ComputerGroups()
  }
  </SCRIPT>
 <BODY>
  <Table><Span ID='Text' Style='Letter-Spacing:2px;Font-Size:8.75pt;'> </Span></Table>
<!-- User Name -->
  <script language="VBScript">
'/-> 
	Function ComputerGroups()   
	 Set colGroups = GetObject("WinNT://" & strComputer & "") : colGroups.Filter = Array("group")
	 For Each objGroup In colGroups 
	   CT = CT + 1
	  Set ObjList = Document.createElement("OPTION")
		ObjList.Value = CT 
		ObjList.Text = objGroup.Name
	   If CT Mod 2 Then
		ObjList.style.backgroundcolor = "#C9C9C9" 
		ObjList.style.color = "#3A3A3A"
	   Else 
		ObjList.style.backgroundcolor = "#E9E9E9" 
		ObjList.style.color = "#235779"
	   End If
	  Groups.Add(ObjList)
	 Next
	   GU = Array(OBJGU)
	   LocalUsers()
	   CT = 0
	End Function
'->
   Dim Comp, DelAccounts, LUser, objUser, strUser
   Function LocalUsers()
	ClearLocalUsers()
	 Set Wmi = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
	 Set colItems = Wmi.ExecQuery("SELECT * FROM Win32_UserAccount",,48) 
	 For Each objItem in colItems
	 If Len(objItem.FullName) = Len(objItem.Name) Then
	  C1 = C1 + 1
	  Set UserList = Document.createElement("OPTION")
	   UserList.Value = C1 
	   UserList.Text = objItem.FullName
	  If C1 Mod 2 Then
	   UserList.style.backgroundcolor = "#C9C9C9" 
	   UserList.style.color = "#3A3A3A"
	  Else 
	   UserList.style.backgroundcolor = "#E9E9E9" 
	   UserList.style.color = "#235779"
	  End If
	  User.Add(UserList)
	 End If
	Next
	CT = 0
   End Function 
'->
   Function SelectTheGroup()
	For Each ObjList in Groups.Options
	 If ObjList.Selected Then 
	   A3 = ObjList.InnerText 
	  End If
	Next
	Exit Function
   End Function 
'->
	Function SelectTheUser()
	 For Each ObjList In User.Options
	  If ObjList.Selected Then strUser = ObjList.InnerText End If
	 Next
	End Function 
'->
	Function RefreshenGroups()
	 For Each ObjList In Groups.Options :ObjList.RemoveNode :Next
	 ComputerGroups()
	End Function 
  </SCRIPT>
  <TABLE Style='position:absolute;Top:20;Left:25;'>User Name</TABLE>
  <INPUT Type='Text' Size='40' Class='TextBackGround' 
   Style='position:absolute;Top:20;Left:115;'
   Name='UserName' tabindex=1 OnFocusOut=''>
<!-- Password -->
  <TABLE Style='position:absolute;Top:45;Left:25;'>Password</TABLE>
  <INPUT Type='Text' Size='40' 
   Class='TextBackGround' 
   Style='position:absolute;Top:45;Left:115;'
   Name='PassWord' tabindex=2>
<!-- Groups -->
  <TABLE Style='position:absolute;Top:70;Left:25;'>Groups</TABLE>
  <Select size='1' Name='Groups' Class='Bx1' 
   Style='width:230;position:absolute;Top:70;Left:115;' tabindex=3></Select>
<!-- Local Users -->
  <TABLE Style='position:absolute;Top:95;Left:25;'>Local Users</TABLE>
  <Select size='1' Name='User' Class='Bx1' 
   Style='width:230;position:absolute;Top:95;Left:115;' tabindex=3></Select>
<!--  -->
 <BUTTON ID='Btn01' Style='Left:6;'  
  OnMouseOver='this.style.color="#004211"' 
  OnMouseOut='this.style.color="#001142"'
  OnClick='UserAdd()'>Add User</BUTTON>
  <script language="VBScript">
  <!--
	Function UserAdd()
	 Dim ColGroup, NewUser, Z1
	 A1 = UserName.value
	 If UserName.value = "" Then
	   window.alert vbTab & "Error No User Name" & vbcrlf & "Type In The User Name In The User Name Textbox."
	  Exit Function
	 End If 
	 If PassWord.value = "" Then 
	  A2 = "This account will not have a password" & vbcrlf & "for this user, " & Chr(187) & Space(2) & A1
	  A2 = A2 & Vbcrlf & "You can add the password to this acccount, " & vbcrlf &_
	  "by using the Windows User Tools later"
	 End If 
	 If PassWord.value <> "" Then 
	  A2 = "User Password " & vbtab & PassWord.value 
	 End If
	 SelectTheGroup()
	 Z1 = window.confirm("Is this the correct information" & vbcrlf &_
		   "New User Name " & vbtab & A1 & vbcrlf & A2 & vbcrlf &_
		   "Security Group" & vbtab & A3)
	 If Z1 = True Then 
	  Set colAccounts = GetObject("WinNT://" & strComputer & "")
	  Set objGroup = GetObject("WinNT://" & strComputer & "/" & A3 & ",group")
	  Set objUser = colAccounts.Create("user", "" & A1 & "")
	  objUser.SetPassword "" & PassWord.value & ""
	  objUser.SetInfo
	  objGroup.Add(objUser.ADsPath)
	 End If
	 If Z1 = False Then ClearText() 
	 LocalUsers() :RefreshenGroups() :ClearText()
	 Exit Function
	End Function
'->
	Function ClearLocalUsers()
	 For Each objOption In User.Options 
	  If Instr(objOption.Text,"Select User") Then
	  Else
	  objOption.RemoveNode
	  End If 
	Next 
	Exit Function 
   End Function 
'->
   Function ClearText()
	 UserName.value=""
	 PassWord.value=""   
	Exit Function 
   End Function 
  -->
  </SCRIPT>
<!--  -->
 <BUTTON ID='Btn02' 
  Style='Position:Absolute;Bottom:15;Left:96;'  
  OnMouseOver='this.style.color="#004211"' 
  OnMouseOut='this.style.color="#001142"'
  OnClick='DeleteAUser()'>Delete User</BUTTON>
  <script language="VBScript">
	Function DeleteAUser()
	 SelectTheUser()
	  If strUser <> "" Then 
		Set Comp = GetObject("WinNT://" & strComputer & "")
		 Z1 = window.confirm("Are you sure you want to delete this account?" &_
		  vbCrlf & VbTab & Chr(187) & Space(2) & strUser)
		 If Z1 = True Then 
		  Comp.Delete "user", strUser
		  ClearLocalUsers()
		  LocalUsers()
		 End if 
	   End If 
	 End Function
  </SCRIPT>
<!--  -->
 <BUTTON ID='Btn03' Style='Left:186;' 
 OnMouseOver='this.style.color="#004211"' 
 OnMouseOut='this.style.color="#001142"' 
 OnClick="ClearText()">Clear Text</BUTTON>
<!--  -->
 <BUTTON ID='Btn04' Style='Left:276;' 
 OnMouseOver='this.style.color="#004211"' 
 OnMouseOut='this.style.color="#001142"'
 OnClick='CloseHta()'>Close</BUTTON>
  <script language="VBScript">
  Function CloseHta()
   If Fso.FileExists(Hta) Then  Fso.DeleteFile(Hta)
	window.close()
  End Function
  </SCRIPT>
 </BODY> 

Attached File(s)


This post has been edited by Yzöwl: 29 January 2008 - 02:27 PM
Reason for edit: code tags replaced to improve board formatting


#4 User is offline   navyjax2 

  • Group: Members
  • Posts: 5
  • Joined: 12-February 08

Posted 12 February 2008 - 08:47 PM

The HTA Applications didn't work for me, kept giving me "Do you want to keep running scripts on this page?" errors, but the EXE was great! I didn't know what the "Local Users" section was for, though... it doesn't really apply to the account you are going to create. Just for follow-on to what your program does, might be nice to have a First Name and Last Name box, then make the user name automatically be the first initial and last name (i.e. John Doe = jdoe), and have that populate into the account on creation. Just a thought. I saw you put a lot of work into this. I'm developing something similar. Code I'm using for the above is similar to:

(In HTML page where I get my information from:)
<INPUT type="textbox" id="txtFirstName" size="30" />
<INPUT type="textbox" id="txtLastName" size="30" />
<INPUT type="button" value="Add User" onclick="addUser()" />

(In the SCRIPT section:)
Sub addUser()

'Establish user info
dim firstName, lastName, userAccount, fullName
dim objRootLDAP, objString, objContainer, objUser, objShell
firstName = document.getElementById("txtFirstName").value
lastName = document.getElementById("txtLastName").value
userAccount = Left(firstName,1) & lastName
fullName = firstName & " " & lastName

' Bind to Active Directory
Set objRootLDAP = GetObject("LDAP://rootDSE")
objString = "LDAP://OU=Test,DC=DOMAIN,DC=com"
Set objContainer = GetObject(objString)

'Build user
Set objUser = objContainer.Create("User", "cn=" & userAccount)
objUser.Put "samAccountName", userAccount
objUser.Put "givenName", fullName
objUser.SetInfo

' Optional section to launch Active Directory Uses and Users
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%systemroot%\system32\dsa.msc"
Set objContainer = Nothing
WScript.Quit

End Sub


I have a drop-down similar to yours, also, for the groups that I just hard-coded with values.... been having trouble getting the group listing dynamically and applying it, but otherwise above is the basics for anyone that is trying to get started somewhere.

-Tom

This post has been edited by navyjax2: 12 February 2008 - 10:33 PM


#5 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 12 February 2008 - 11:24 PM

Thanks
I took what you posted and fixed it up so it will only work if there a 2 value from the textboxes.
Save as a hta file.

Quote

 <HEAD>
 <HTML
  xmlns:v='urn:schemas-microsoft-com:vml'
  xmlns:o='urn:schemas-microsoft-com:office:office'
  xmlns:w='urn:schemas-microsoft-com:office:word'
  xmlns='http://www.w3.org/TR/REC-html40'>
 <TITLE>Manage Local Users</TITLE>
 <HTA:APPLICATION ID='ManageLocalUsers'
  Scroll='No'			 
  SCROLLFLAT ='No'		
  SingleInstance='Yes'
  SysMenu='Yes'
  ShowInTaskBar='No'
  MaximizeButton='No'
  MinimizeButton='No'	 
  Border='Thin'
  BORDERSTYLE ='complex'  
  INNERBORDER ='Yes'
  Caption='Yes'  
  WindowState='Normal'
  APPLICATIONNAME='Manage_Local_Users' 
  Icon='%SystemRoot%\explorer.exe'>
  
 <STYLE Type="text/css">
  Body
   {
	Font-Size:8.05pt;
	Font-Weight:Bold;
	Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
	Color:#001254;
	BackGround-Color:Transparent;
	Filter:progid:DXImageTransform.Microsoft.Gradient
	(StartColorStr='#fdf7f1',endColorStr='#d1cbc5');
	Margin-Top:1;
	Margin-Bottom:1;
	Margin-Left:4;
	Margin-Right:4;
	Padding-Top:1;
	Padding-Bottom:1;
	Padding-Left:4;
	Padding-Right:4;
	Text-Align:Center;
	Vertical-Align:Top;
	Border-Top:2px Solid #a6a29e;
	Border-Bottom:3px Solid #cbc7c3;
	Border-Left:2px Solid #b2aeaa;
	Border-Right:3px Solid #bcb8b4;
   }
  .TextBackGround
  {
	Font-Size:8.05pt;
	Font-Weight:Bold;
	Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
	Color:#1e1e1e;
	filter:progid:DXImageTransform.Microsoft.Gradient
	(StartColorStr='#e2ded8',EndColorStr='#e8e2de;');
	padding-top:1;
	padding-bottom:1;
	Border-left: 2px Solid #75b8d7;
	Border-right: 1px Transparent #6480af;
	Border-top: 2px Solid #75b8d7;
	Border-Bottom: 1px Transparent #6480af;
   }
  BUTTON
   {
	Width:85;
	Height:15pt;
	Cursor:Hand;
	Font-Size:8.05pt;
	Font-Weight:Bold;
	Font-Family:Arial,Tahoma,Comic Sans MS,Segoe Ui;
	Color:#001142;
	Filter:progid:DXImageTransform.Microsoft.Gradient
	(StartColorSTR='#bbddff',endColorSTR='#224488');
	Padding-Top:1;
	Padding-Bottom:2;
	Margin-Left:5pt;
	Margin-Right:5pt;
	Border-Top:1px TransParent;
	Border-Bottom:2px TransParent;
	Border-Left:1px TransParent;
	Border-Right:2px TransParent;
   }
 </STYLE>
  <script Language="JavaScript">
  window.resizeTo (525,125),window.moveTo (100,125);
  </SCRIPT>
  <script language="VBScript">
  Dim Chk1, Chk2, F_Name, Full_ID, L_Name, User
  Dim objRootLDAP, objString, objContainer, objUser, objShell
   Function addUser()
'-> Establish user info
'-> Check To Make Sure There A Value
   If document.getElementById("FirstName").value = "" Then
	alert("Error There Was No User Input" & vbcrlf & _
		  "Please Type In A First Name")
	 Exit Function
   End If 
   If document.getElementById("FirstName").value <> "" Then
	Chk1 = True
	F_Name = document.getElementById("FirstName").value
	alert(F_Name)   
   End If 
'-> First Name Has A Value
   If Chk1 = True Then 
'-> Check To Make Sure There A Value
   If document.getElementById("LastName").value = "" Then
	alert("Error There Was No User Input" & vbcrlf & _
		  "Please Type In A First Name")
	 Exit Function
   End If
   If document.getElementById("LastName").value <> "" Then
	Chk2 = True
	L_Name = document.getElementById("LastName").value
	User = Left(F_Name,1) & L_Name
	Full_ID = F_Name & " " & L_Name   
   End If 
   End If
'-> Both Boxes Has Value Lets Add The User
   If Chk2 = True Then 
'-> Bind to Active Directory
	Set objRootLDAP = GetObject("LDAP://rootDSE")
	objString = "LDAP://OU=Test,DC=DOMAIN,DC=com"
	Set objContainer = GetObject(objString)
'-> Build user
	Set objUser = objContainer.Create("User", "cn=" & User)
	objUser.Put "samAccountName", User
	objUser.Put "givenName", Full_ID
	objUser.SetInfo
   End If
'-> Optional section to launch Active Directory Uses and Users
	' Set objShell = CreateObject("WScript.Shell")
	' objShell.Run "%systemroot%\system32\dsa.msc"
	' Set objContainer = Nothing
	'  WScript.Quit
	End Function
  </SCRIPT>
 </HEAD><BODY><DIV Style='Margin-Top:5;Margin-Bottom:5;Font-Size:10.05pt;'>Add A Local User</DIV>
 <INPUT Class='TextBackGround' type="textbox" id="FirstName" size="30" />
 <INPUT Class='TextBackGround' type="textbox" id="LastName" size="30" />
 <Button onclick="addUser()">Add User</BUTTON>
</BODY></HTML>


#6 User is offline   navyjax2 

  • Group: Members
  • Posts: 5
  • Joined: 12-February 08

  Posted 14 February 2008 - 01:53 AM

Looks good - the user was added with a first initial, last name user account. I did have to correct some single-quotes that should've been double-quotes, but that's ok :) I found out that was what was causing my errors when running your HTA scripts before.

A couple of issues I'm trying to resolve -

1) Assigning a password. I created a textbox, i.e.

"<INPUT type="password" id="pWord" />


and am trying to use something like

Set objUser = objContainer.Create("User", "cn=" & userAccount)
objUser.setPassword document.getElementById("pWord").text


(where userAccount is the variable holding the username to be given to my user)

but it would come back with an error on the line number containing that, and if I commented that line out, the error would go away. I'd just like to be able to give a user a generic password and it not me that of the domain admin running the script, and would like to not have to change it once the user is made.

and 2) Adding groups to the user as it is created - I found some code that's supposed to let you do this, but it seems like it's different if you are using local groups

		 Set colAccounts = GetObject("WinNT://" & strComputer & "")	   
		 Set objGroup = GetObject("WinNT://" & strComputer & "/" & A3 & ",group")
   		 objGroup.Add(objUser.ADsPath)


vs. global groups

		strGroup = "CN=" & groupName
		Set objGroup = GetObject("LDAP://" & strGroup & strDNSDomain)
		Set objUser = GetObject("LDAP://CN=" & fullName & "," & strOUs & strDNSDomain)
		objGroup.add(objUser.ADsPath)


. Is there a generic assignment string either way, or a way to tell which way you should go, that I could base off of a drop-down box's value without a lot of effort to tell which is which?

Thanks,
Tom

#7 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 14 February 2008 - 10:08 AM

Try this for the password.

Quote

   <TABLE>Password</TABLE>
  <INPUT Type='Password' Size='40' 
   Name='PassWord' tabindex=2>
   
   <Button OnClick='AddPassWord()' 
   Style='Margin-Left:3;Margin-Right:3;'>Add</BUTTON>
   
   <script language="VBScript">
	Function AddPassWord()
	 If PassWord.value = "" Then 
	   alert("No User Input")
	 End If 
	 If PassWord.value <> "" Then 
	   alert("User Password " & vbtab & PassWord.value)
	 End If
	End Function
   </SCRIPT>


The group stuff I do not know much about, perhaps someone with more information might reply.

#8 User is offline   navyjax2 

  • Group: Members
  • Posts: 5
  • Joined: 12-February 08

Posted 19 February 2008 - 05:11 PM

Yeah, that will give the value of the password box (though in my case I have to reference document.getElementById("pword").value for an <INPUT type="password" ID="pword" name="pword" /> tag), but I knew how do get that. I set the following:

dim strPassword
strPassword = document.getElementById("pword")


but if I were to try to build a user with the following:

dim userAccount, firstName, lastName
firstName = document.getElementById("F_Name")
lastName = document.getElementById("L_Name")		
userAccount = Left(firstName,1) & lastName   ' First Initial, Last Name
Set objUser = objContainer.Create("User", "cn=" & userAccount)
objUser.Put "samAccountName",userAccount
objUser.Put "givenName",firstName
objUser.Put "sn",lastName
objUser.SetPassword strPassword


it's that last line that will cause an error. Why is that?

I also tried

objUser.SetPassword(strPassword)


which I would think would work from http://www.microsoft.com/technet/scriptcen...04/hey1015.mspx, but it didn't. Error is "There is no such object on the server." and the user is not created in the specified OU, where, if I leave just that line out, it will be.

Tom

This post has been edited by navyjax2: 19 February 2008 - 05:25 PM


#9 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 19 February 2008 - 06:24 PM

From what you posted your code

Quote

dim userAccount, firstName, lastName
firstName = document.getElementById("F_Name")
lastName = document.getElementById("L_Name")		
userAccount = Left(firstName,1) & lastName   ' First Initial, Last Name
Set objUser = objContainer.Create("User", "cn=" & userAccount)
objUser.Put "samAccountName",userAccount
objUser.Put "givenName",firstName
objUser.Put "sn",lastName
objUser.SetPassword strPassword

is missing this.

Quote

dim strPassword
strPassword = document.getElementById("pword")

Perhaps this

Quote

dim userAccount, firstName, lastName, strPassword
firstName = document.getElementById("F_Name")
lastName = document.getElementById("L_Name")
strPassword = document.getElementById("pword")	
userAccount = Left(firstName,1) & lastName   ' First Initial, Last Name
Set objUser = objContainer.Create("User", "cn=" & userAccount)
objUser.Put "samAccountName",userAccount
objUser.Put "givenName",firstName
objUser.Put "sn",lastName
objUser.SetPassword strPassword


#10 User is offline   navyjax2 

  • Group: Members
  • Posts: 5
  • Joined: 12-February 08

Posted 19 February 2008 - 08:15 PM

Well, I had meant that I was indeed trying it all together, sorry that wasn't clear. I found out the reason for the error, though. If you don't commit the creation of the user to Active Directory first, it has no object to assign a password to. So you have to do a

objUser.SetInfo


BEFORE you can do a

objUser.SetPassword strPassword


So now I'm building the rest of my HTA - I'm including stuff like the Password will never expire and User cannot change password checkboxes. Still have the group thing to try to incorporate, too. I don't know where the groups like "Domain Admins", etc. (the global groups) live at to get a "CN=" name in the first place. I've got a box that will poll the groups (local and global) from earlier code of yours:

	Function ComputerGroups()

		strComputer = "."

		Set ObjList = document.getElementById("groupSelect")

		Set colGroups = GetObject("WinNT://" & strComputer)
		colGroups.Filter = Array("group")
		For Each objGroup In colGroups

					 set oOption = document.createElement("OPTION")		 
					 ObjList.Options.add oOption		 
					 oOption.innerText = objGroup.Name		 
					 oOption.value = CT

			If CT MOD 2 Then
				oOption.style.backgroundcolor = "#C9C9C9"
				oOption.style.color = "#3A3A3A"
			Else
				oOption.style.backgroundcolor = "#E9E9E9"
				oOption.style.color = "#235779"
			End If
			CT = CT + 1
		Next
		CT = 0
	End Function


I declared "CT" up there as a global variable = 0 in my JavaScript, which includes a window.onload=function() { ComputerGroups(); }, just for those that might be trying to integrate the above into their own functions. The above is used by a selectbox on the form itself:

		<SELECT id="groupSelect" name="groupSelect" class="SelectBox">
			<OPTION value="0"></OPTION>
		</SELECT><BR>


Can the oOption.value be set to the group CN name instead of CT? How would it retrieve that automatically?

Tom

#11 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 24 March 2008 - 12:35 AM

I have fixed it now so the accounts are added now. If you have any suggestion about what to add please post.
This requires net framework to be install.
Posted Image

Attached File(s)


This post has been edited by gunsmokingman: 25 March 2008 - 11:39 AM


#12 User is offline   MAVERICKS CHOICE 

  • The Guy from Aus
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,693
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 25 March 2008 - 03:56 PM

Thats a very handy ute GSM, your becoming a talented HTA man.

#13 User is online   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,352
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 25 March 2008 - 04:04 PM

The new one is a Vb.net app the hta is posted a couple of post up.
Thank you MC

I have made some layout changes and added the ability to disable or enable Local User Accounts.
Posted Image
Posted Image

Attached File(s)


This post has been edited by gunsmokingman: 25 March 2008 - 08:36 PM


#14 User is offline   MAVERICKS CHOICE 

  • The Guy from Aus
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,693
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

  Posted 26 March 2008 - 03:10 AM

View Postgunsmokingman, on Mar 26 2008, 09:04 AM, said:

The new one is a Vb.net app the hta is posted a couple of post up.
Thank you MC

I have made some layout changes and added the ability to disable or enable Local User Accounts.
Posted Image
Posted Image


Apologize man, I did in fact sample the wrong one, Just DL'd it now is very good & will be testing it further.

#15 User is offline   swinomish 

  • Group: Members
  • Posts: 5
  • Joined: 29-April 08

Posted 29 April 2008 - 03:44 PM

I created a new thread for my script at this link since my script is quite different then the script in this thread.

http://www.msfn.org/...rm-t120592.html

This post has been edited by swinomish: 14 July 2008 - 01:13 PM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy