Create User Script

Change Page: < 123456789 | Showing page 9 of 9, messages 161 to 178 of 178
Author Message
cjwallace

  • Total Posts : 549
  • Scores: 0
  • Reward points : 0
  • Joined: 3/5/2005
  • Location: United Kingdom
  • Status: offline
RE: Re: Create User Script Monday, July 31, 2006 1:29 AM (permalink)
0
Wow nice to see this script is still helping \ giving people ideas
 
 
If i can help with this in anyway please let me know. This script started off quite small but got massive over time
 
    Snipah

    • Total Posts : 1339
    • Scores: 8
    • Reward points : 0
    • Joined: 11/1/2004
    • Location: Scotland
    • Status: offline
    RE: Re: Create User Script Monday, July 31, 2006 2:29 AM (permalink)
    0
    Cool...
     
    Did you post it at the Post Your VBScript yet?
     
    Or you might post it here (please use the [ code ] tags...)
     
    ;)
    For more information, please see the "Read me First" topic.

    http://www.visualbasicscript.com
     
      IdTenT

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 7/29/2006
      • Status: offline
      RE: Re: Create User Script Monday, July 31, 2006 6:15 AM (permalink)
      0
      [/align]<html> 
       <HTA:APPLICATION 
       APPLICATIONNAME="Account Creation" 
       SCROLL="no" 
       SINGLEINSTANCE="yes" 
       WINDOWSTATE="normal" 
       > 
       <head> 
       <title>User Account Creation Form</title> 
       <style type="text/css"> 
       <!-- 
       .style3 {font-size: 13px} 
       body,td,th { 
       font-family: Arial, Helvetica, sans-serif; 
       } 
       .style2 { font-family: Arial, Helvetica, sans-serif; 
       font-size: 13.5pt; 
       color: #CC6600; 
       font-weight: bold; 
       } 
       .style5 {font-size: small; color: #FF0000; } 
       .style6 {color: #FF0000} 
       --> 
       </style> [/align] [/align]<script type="text/vbscript"> 
       Sub CreateAccount [/align] [/align]strUser = TextBox0.Value 
       If strUser = "" Then 
       MsgBox "You're missing required fields.",64, "Alert" 
       Exit Sub 
       End If [/align] [/align]strFirst = TextBox1.Value 
       If strFirst = "" Then 
       MsgBox "You're missing required fields",64, "Alert" 
       Exit Sub 
       End If [/align] [/align]strInitial = TextBox2.Value [/align] [/align]strLast = TextBox3.Value 
       If strLast = "" Then 
       MsgBox "You're missing required fields",64, "Alert" 
       Exit Sub 
       End If [/align] [/align]strDisplay = strLast & ", " & strFirst [/align] [/align]Set objConnection = CreateObject("ADODB.Connection") 
       objConnection.Open "Provider=ADsDSOObject;" [/align] [/align]Set objCommand = CreateObject("ADODB.Command") 
       objCommand.ActiveConnection = objConnection [/align] [/align]objCommand.CommandText = _ 
       "<GC://dc=XXXX,dc=XXXX,dc=XXXX,dc=com>;(&(objectCategory=Person)(objectClass=user)" & _ 
       "(samAccountName=" & strUser & "));samAccountName;subtree" [/align] [/align]Set objRecordSet = objCommand.Execute [/align] [/align]If objRecordSet.RecordCount = 0 Then [/align] [/align]Else 
       MsgBox "The User Account already exists.",48,"Alert" 
       Exit Sub 
       End If [/align] [/align]objConnection.Close [/align] [/align]Const ADS_UF_ACCOUNTDISABLE = 2 
       Const ADS_PROPERTY_UPDATE = 2 [/align] [/align]Set objRootDSE = GetObject("[link=http://www.visualbasicscript.com/ldap://rootDSE]LDAP://rootDSE[/link]")
       strContainer = "ou=test,ou=test,ou=Users,ou=User Accounts"
       Set objOU = GetObject("LDAP://" & strContainer & "," & _
            objRootDSE.Get("defaultNamingContext"))
       Set objUser = objOU.Create("User", "cn=" & strUser) 
       objUser.Put "sAMAccountName", LCase(strUser) 
       objUser.SetInfo [/align] [/align]objUser.Put "givenName", strFirst [/align] [/align]If strInitial <> "" Then 
       objUser.Put "initials", strInitial 
       End If [/align] [/align]objUser.Put "sn", strLast 
       objUser.Put "displayName", strDisplay [/align] [/align]objUser.SetPassword "password" 
       objUser.Put "pwdLastSet", 0 [/align] [/align]intUAC = objUser.Get("userAccountControl") 
       If intUAC And ADS_UF_ACCOUNTDISABLE Then 
       objUser.Put"userAccountControl", intUAC Xor ADS_UF_ACCOUNTDISABLE 
       End If 
       objUser.SetInfo [/align] [/align]End Sub [/align] [/align]Sub Reload 
       Location.Reload(True) 
       End Sub [/align] [/align]Sub bodyLoaded() 
       window.ResizeTo 600,510 ' WIDTH, HEIGHT 
       End Sub [/align] [/align]</script> 
       </head> 
       <body onLoad="bodyLoaded()"> 
       <p><img src="/images/logo.gif" width="189" height="46"></p> 
       <p class="style2">Account Creation Page.</p> 
       <table width="289" border="0" align="left"> 
       <tr> 
       <td width="89"><span class="style5">*</span>Login ID: </td> 
       <td width="144"><input type="text" name="textbox0"></td> 
       </tr> 
       <tr> 
       <td><span class="style5">*</span>First Name:</td> 
       <td><input type="text" name="textbox1"></td> 
       </tr> 
       <tr> 
       <td>Middle Initial: </td> 
       <td><input type="text" name="textbox2"></td> 
       </tr> 
       <tr> 
       <td><span class="style5">*</span>Last Name: </td> 
       <td><input type="text" name="textbox3"></td> 
       </tr> 
       </table> 
       <p> </p> 
       <p> </p> 
       <p> </p> 
       <p><br> 
       <input type="button" name="Submit" value="Submit" onClick="CreateAccount"> 
       </p> 
       <p>The login ID will have an initial password of password. </p> 
       <p>The new employee will also be requiered to change their password at first logon. </p> 
       <p class="style3"><span class="style6">*</span> Indicates Required Field</p> 
       <p> 
       <input id="reloadbutton" class="button" type="reset" value="Clear Form" name="reload_button" onClick="Reload"> 
       </p> 
       <p> 
       <input type="button" value=" Exit " name="close_button" onClick="Self.Close"> 
       </p> 
       </body> 
       </html> [/align]
       
        cjwallace

        • Total Posts : 549
        • Scores: 0
        • Reward points : 0
        • Joined: 3/5/2005
        • Location: United Kingdom
        • Status: offline
        RE: Re: Create User Script Saturday, October 07, 2006 3:04 AM (permalink)
        0
        Hi guys.

        Looks like i am coming back to this script again

        ok as we are in the process of moving to Exchange 2003 i need to start to update my script to create the Exchange mails box as part of the process.

        I am trying to find a some info \ a basic script that creates Exchange account to start with.

        Does anyone have a basic script or any info on how to do this?

        Many thanks
         
          Snipah

          • Total Posts : 1339
          • Scores: 8
          • Reward points : 0
          • Joined: 11/1/2004
          • Location: Scotland
          • Status: offline
          RE: Re: Create User Script Saturday, October 07, 2006 7:39 PM (permalink)
          0
          As we say: did you search yet?
           
          Gooooogle gave me this one directly:
          http://www.msexchange.org/articles/Scripting-Exchange-VBScript-ADSI-Part1.html
          For more information, please see the "Read me First" topic.

          http://www.visualbasicscript.com
           
            shanfont

            • Total Posts : 10
            • Scores: 0
            • Reward points : 0
            • Joined: 2/21/2007
            • Status: offline
            RE: Re: Create User Script Friday, February 23, 2007 2:44 AM (permalink)
            0
            I don't know if this post is closed or not but I didn't see anyone comment on this script that ThePiriah posted.  I like the layout allot better but me being a newbie with scripting I don't fully get all the code.  When testing this script I'm getting an error of Line:100, Char:1, Error:Object required: 'txtUser'.  I'm not sure what to put in those quotation marks if anything.  I'm trying to use this script for my HR Dept to create users that will put them in the correct OU and set them up with a email address that has a specific format of the first four letters of the users first name and first four letters of users last name.  For a total of eight characters and no more no less.  I would also like an option to disable an account that would remove mailbox and hide the disabled account from global address list.  I know this is allot to ask but I'm working on it using this base script.  I would appreciate any input.  Thanks. 


             <html> 
             <head> 
             <title>User Account Creation Form v2.0</title> 
             <HTA:APPLICATION 
             ID = "AccountCreationApp" 
             APPLICATIONNAME="Account Creation" 
             BORDER = "thin" 
             CAPTION = "yes" 
             RESIZE = "no" 
             ICON = "sprocket.ico" 
             SHOWINTASKBAR = "yes" 
             SINGLEINSTANCE = "yes" 
             SYSMENU = "yes" 
             WINDOWSTATE = "normal" 
             SCROLL = "yes" 
             SCROLLFLAT = "yes" 
             VERSION = "2.0" 
             INNERBORDER = "no" 
             SELECTION = "no" 
             MAXIMIZEBUTTON = "no" 
             MINIMIZEBUTTON = "yes" 
             NAVIGABLE = "yes" 
             CONTEXTMENU = "yes" 
             BORDERSTYLE = "normal"> 
             </hta> 
             <style> 
             BODY 
             { 
             background-color: #E5ECF9; 
             font-family: Helvetica; 
             font-size: 8pt; 
             margin-top: 10px; 
             margin-left: 20px; 
             margin-right: 10px; 
             margin-bottom: 10px; 
             scrollbar-track-color: #E5ECF9; 
             scrollbar-3dlight-color: #E5ECF9; 
             scrollbar-arrow-color: #E5ECF9; 
             scrollbar-base-color: #E5ECF9; 
             scrollbar-darkshadow-color: #E5ECF9; 
             scrollbar-face-color: #E5ECF9; 
             scrollbar-highlight-color: #E5ECF9; 
             scrollbar-shadow-color: #E5ECF9 
             } 
             TD 
             { 
             font-family: Trebuchet MS; 
             font-size: 8pt; 
             } 
             LEGEND 
             { 
             font-family: Trebuchet MS; 
             font-size: 10pt; 
             } 
             SELECT 
             { 
             font-family: Trebuchet MS; 
             font-size: 8pt; 
             width:195px 
             } 
             INPUT 
             { 
             font-family: Trebuchet MS; 
             font-size: 8pt; 
             } 
             </style> 
             
             
             <script language="VBScript"> 
             Dim defaultNC, BaseOU 
             defaultNC = GetObject("LDAP://RootDSE").Get("DefaultNamingContext") 
             BaseOU = "OU=Domain Clients," & defaultNC 
             Logpath ="C:\logs\" 
             Const FORAPPENDING = 8 
             sub window_onload 
             Dim x,y 
             x = (window.screen.width - 750) / 2 
             y = (window.screen.height - 700) / 2 
             If x < 0 Then x = 0 
             If y < 0 Then y = 0 
             window.resizeTo 765,600 
             window.moveTo x,y 
             end sub 
             Sub chkExch_OnClick() 
             If chkExch.checked = true Then 
             cbxExch.Disabled = 0 
             Else 
             cbxExch.Disabled = 1 
             End If 
             End Sub 
             Sub chkDL_OnClick() 
             If chkDL.checked = true Then 
             cbxDL.Disabled = 1 
             Else 
             cbxDL.Disabled = 0 
             End If 
             End Sub 
             ' ## Start user account creation process ## 
             Sub CreateAccount 
             strUser = txtUser.Value 
             If strUser = "" Then 
             MsgBox "You are missing required fields.",64, "Alert" 
             Exit Sub 
             End If 
             strFirst = txtFirst.Value 
             If strFirst = "" Then 
             MsgBox "You are missing required fields.",64, "Alert" 
             Exit Sub 
             End If 
             strInitial = txtMiddle.Value 
             strLast = txtLast.Value 
             If strLast = "" Then 
             MsgBox "You are missing required fields.",64, "Alert" 
             Exit Sub 
             End If 
             strDisplay = UCase(Left(strLast, 1)) & LCase(Right(strLast, Len(strLast) - 1)) & " " _ 
             & UCase(Left(strFirst, 1)) & LCase(Right(strFirst, Len(strFirst) - 1)) 
             strTitle = txtTitle.Value 
             strOffice = cbxSite.Value 
             strDepartment = txtDepartment.Value 
             strCompany = txtCompany.Value 
             strManager = txtManager.Value 
             strCN = UCase(Left(strLast, 1)) & LCase(Right(strLast, Len(strLast) - 1)) & " " _ 
             & UCase(Left(strFirst, 1)) & LCase(Right(strFirst, Len(strFirst) - 1)) 
             Set objConnection = CreateObject("ADODB.Connection") 
             objConnection.Open "Provider=ADsDSOObject;" 
             Set objCommand = CreateObject("ADODB.Command") 
             objCommand.ActiveConnection = objConnection 
             objCommand.CommandText = _ 
             "<GC://" & defaultNC & ">;(&(objectCategory=Person)(objectClass=user)" & _ 
             "(samAccountName=" & strUser & "));samAccountName;subtree" 
             Set objRecordSet = objCommand.Execute 
             If objRecordSet.RecordCount = 0 Then 
             Else 
             MsgBox "The User Account already exists.",48,"Alert" 
             Exit Sub 
             End If 
             objConnection.Close 
             
             Const FORWRITING= 2 
             Const ADS_UF_ACCOUNTDISABLE = 2 
             Const ADS_PROPERTY_UPDATE = 2 
             Const ADS_PROPERTY_APPEND = 3 
             
             ' ## Determine if Creation of User Mailbox required ## 
             If chkExch.checked = "True" And cbxExch.value = "cbxExchAlert" Then 
             MsgBox "You must select either a Server/Mailstore or " & vbcrlf _ 
             & "de-select the 'Create Mailbox' checkbox." ,64, "Alert" 
             Exit Sub 
             End If 
             ' ## Add user to required Distribution List ## 
             If chkDL.checked ="True" And cbxDL.value = "cbxDLAlert" Then 
             MsgBox "You must select a Distribution List or " & vbcrlf _ 
             & "de-select the 'Distribution List' checkbox." ,64, "Alert" 
             Exit Sub 
             End If 
             ' ## Ensure users site/office selected ## 
             If cbxSite.Value = "cbxOfficeAlert" Then 
             MsgBox "You must select the users office.",64, "Alert" 
             Exit Sub 
             End If 
             Select Case cbxSite.Value 
             Case "Birmingham" 
             strOffice = "Birmingham" 
             strLDAPdn = "OU=_ Birmingham," & BaseOU 
             strUserServer = "Northsea" 
             Case "Exeter" 
             strOffice = "Exeter" 
             strLDAPdn = "OU=_ Exeter," & BaseOU 
             strUserServer = "Cluster" 
             Case "Hatfield" 
             strOffice = "Hatfield" 
             strLDAPdn = "OU=_ Hatfield," & BaseOU 
             strUserServer = "Data1Hat" 
             Case "Leeds" 
             strOffice = "Leeds" 
             strLDAPdn = "OU=_ Leeds," & BaseOU 
             strUserServer = "Sagat" 
             Case "Newcastle" 
             strOffice = "Newcastle" 
             strLDAPdn = "OU=_ Newcastle," & BaseOU 
             strUserServer = "fluorine" <!-- Arsenic --> 
             Case "Other" 
             strOffice = "Other" 
             strLDAPdn = "OU=_ Other," & BaseOU 
             strUserServer = "fluorine" 
             Case "Other" 
             strOffice = "Other" 
             strLDAPdn = "OU=_ Oxford," & BaseOU 
             strUserServer = "Data1Oxf" 
             Case "Paddington" 
             strOffice = "Paddington" 
             strLDAPdn = "OU=_ Paddington," & BaseOU 
             strUserServer = "Data1Pad" 
             Case "Portland House" 
             strOffice = "Portland" 
             strLDAPdn = "OU=_ Portland House," & BaseOU 
             strUserServer = "Data1Pot" 
             Case "Redditch" 
             strOffice = "Redditch" 
             strLDAPdn = "OU=_ Redditch," & BaseOU 
             strUserServer = "Red-DC" 
             Case "Richmond House" 
             strOffice = "Richmond House" 
             strLDAPdn = "OU=_ Richmond House," & BaseOU 
             strUserServer = "Data1Rich" 
             Case "Slough" 
             strOffice = "Slough" 
             strLDAPdn = "OU=_ Slough," & BaseOU 
             strUserServer = "Data1Slo" 
             Case "Tavistock" 
             strOffice = "Tavistock House" 
             strLDAPdn = "OU=_ Tavistock House," & BaseOU 
             strUserServer = "fluorine" <!-- maverick --> 
             Case "Winchester" 
             strOffice = "Winchester" 
             strLDAPdn = "OU=_ Winchester," & BaseOU 
             strUserServer = "fluorine" 
             End Select 
             
             Set objOU = GetObject("LDAP://" & strLDAPdn) 
             Set objUser = objOU.Create("User", "cn=" & strCN) 
             
             objUser.Put "sAMAccountName", LCase(strUser) 
             objUser.SetInfo 
             objUser.Put "givenName", UCase(Left(strFirst, 1)) & LCase(Right(strFirst, Len(strFirst) - 1)) 
             If strInitial <> "" Then 
             objUser.Put "initials", UCase(Left(strInitial, 1)) & LCase(Right(strInitial, Len(strInitial) - 1)) 
             End If 
             objUser.Put "sn", UCase(Left(strLast, 1)) & LCase(Right(strLast, Len(strLast) - 1)) 
             objUser.Put "displayName", UCase(Left(strLast, 1)) & LCase(Right(strLast, Len(strLast) - 1)) & " " _ 
             & UCase(Left(strFirst, 1)) & LCase(Right(strFirst, Len(strFirst) - 1)) 
             
             If strTitle <> "" Then 
             objUser.put "title", strTitle 
             End If 
             If strDepartment <> "" Then 
             objUser.put "department", strDepartment 
             End If 
             If strCompany <> "" Then 
             objUser.put "company", strCompany 
             End If 
             If strManager <> "" Then 
             objUser.put "manager", strManager 
             End If 
             objUser.put "physicalDeliveryOfficeName", strOffice 
             objUser.put "description", strTitle 
             objUser.Put "userPrincipalName", LCase(strUser) & "@" & defaultNC 
             
             objUser.SetPassword "welcome" 
             objUser.Put "pwdLastSet", 0 
             
             intUAC = objUser.Get("userAccountControl") 
             If intUAC And ADS_UF_ACCOUNTDISABLE Then 
             objUser.Put"userAccountControl", intUAC Xor ADS_UF_ACCOUNTDISABLE 
             End If 
             objUser.SetInfo 
             ' ## Add Users to selected groups ## 
             If chkGrpOne.Checked Then 
             Set objGroup = GetObject _ 
             ("LDAP://cn=NPFIT,OU=Other Mail-enabled Security Groups,OU=Groups,OU=__ Migration Staging," & BaseOU) 
             objGroup.PutEx ADS_PROPERTY_APPEND, _ 
             "member", Array("cn=" & strCN & "," & strLDAPdn) 
             objGroup.SetInfo 
             End If 
             
             If chkGrpTwo.Checked Then 
             Set objGroup = GetObject _ 
             ("LDAP://cn=Share - NPSO Files,OU=File Share Access,OU=Groups,OU=__ Migration Staging," & BaseOU) 
             objGroup.PutEx ADS_PROPERTY_APPEND, _ 
             "member", Array("cn=" & strCN & "," & strLDAPdn) 
             objGroup.SetInfo 
             End If 
             
             If chkGrpThree.Checked Then 
             Set objGroup = GetObject _ 
             ("LDAP://cn=Shared Data,OU=Universal Security,OU=Groups (Don't Migrate?),OU=_ Migration Staging - DO NOT MOVE OR ADD OBJECTS HERE!," & defaultNC) 
             objGroup.PutEx ADS_PROPERTY_APPEND, _ 
             "member", Array("cn=" & strCN & "," & strLDAPdn) 
             objGroup.SetInfo 
             End If 
             ' ## Create User Mailbox Process ## 
             
             If ChkExch.Checked Then 
             Call CreateMailbox (strCN,strLDAPdn) 
             End If 
             ' ## Create User Folder Process ## 
             If chkUserFolder.Checked Then 
             Call CreateUserFolder (strUser,strUserServer) 
             End If 
             ' ## Writes entry into logfile ## 
             If chkLogging.Checked Then 
             WriteLog("Account Created: " & DateToStr() & ", " & Time() & ", " & strUser _ 
             & ", " & strFirst & " " & strLast & ", " & strOffice) 
             End If 
             ' ## Reloads Page on completion of User Creation ## 
             Location.Reload(True) 
             MsgBox "User Successfully Created.",64, "Alert - User Creation Successful." 
             End Sub 
             Sub CreateMailbox (strCN,strLDAPdn) 
             ' ## Start Mail Account Creation Process ## 
             
             Dim oIADSUser 
             Dim strMStore 
             Set oIADSUser = GetObject("LDAP://cn=" & strCN & "," & strLDAPdn) 
             ' ## EXCHPE MAIL STORES ## 
             Select Case cbxExch.Value 
             Case "EXCHPEA2G" 
             strExchServer = "EXCHPE" 
             strMStore = "A2G" 
             strStoreGP = "2nd Storage Group" 
             Case "EXCHPEH2M" 
             strExchServer = "EXCHPE" 
             strMStore = "H2M" 
             strStoreGP = "2nd Storage Group" 
             Case "EXCHPEN2S" 
             strExchServer = "EXCHPE" 
             strMStore = "N2S" 
             strStoreGP = "3rd Storage Group" 
             Case "EXCHPET2Z" 
             strExchServer = "EXCHPE" 
             strMStore = "T2Z" 
             strStoreGP = "3rd Storage Group" 
             ' ## EXCHAQ2 MAIL STORES ## 
             Case "EXCHAQ2A2G" 
             strExchServer = "EXCHAQ2" 
             strMStore = "A2G" 
             strStoreGP = "2nd Storage Group" 
             Case "EXCHAQ2H2M" 
             strExchServer = "EXCHAQ2" 
             strMStore = "H2M" 
             strStoreGP = "2nd Storage Group" 
             Case "EXCHAQ2N2S" 
             strExchServer = "EXCHAQ2" 
             strMStore = "N2S" 
             strStoreGP = "3rd Storage Group" 
             Case "EXCHAQ2T2Z" 
             strExchServer = "EXCHAQ2" 
             strMStore = "T2Z" 
             strStoreGP = "3rd Storage Group" 
             Case "ODIN" 
             strExchServer = "ODIN" 
             strMStore = "Mailbox Store (ODIN)" 
             strStoreGP = "First Storage Group" 
             End Select 
             
             oIADSUser.CreateMailbox ("LDAP://CN=" & strMStore & ",CN=" & strStoreGP & ",CN=InformationStore,CN=" & strExchServer & ",CN=Servers,CN=NHSIA,CN=Administrative Groups,CN=NHS,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=nhsia,DC=nhs,DC=uk") 
             oIADSUser.SetInfo 
             ' ## End of Mail Account Creation Process ## 
             End Sub 
             Sub CreateUserFolder (strUser,strUserServer) 
             
             ' ## If Users Home Server is flourine then Users home drive has to be created manually ## 
             If strUserServer = "fluorine" Then 
             MsgBox "User folder must be created manually.",16, "Alert - Folder Creation Unsuccessful." 
             Exit Sub 
             End If 
             ' ## Create the Users home folder on respective server ## 
             Set objFSO = CreateObject("Scripting.FileSystemObject") 
             Set objFolder = objFSO.GetFolder("\\" & strUserServer & "\users") 
             ' ## Create users home folder ## 
             If objFSO.FolderExists("\\" & strUserServer & "\users\" & strUser) = False Then 
             objFSO.CreateFolder("\\" & strUserServer & "\users\" & LCase(strUser)) 
             End If 
             
             ' ## Assign user change NTFS permissions on home drives ## 
             Set objShell = CreateObject("Wscript.Shell") 
             strUserFolder = "\\" & strUserServer & "\users\" & strUser 
             objShell.Run ("SetACL.exe -on """ & strUserFolder & """ -ot file -actn ace " & "-ace ""n:npfit.nhs.uk\" & strUser & ";p:change""") 
             End Sub 
             Sub WriteLog (strMessage) 
             Dim LogFile 
             Dim fs 
             Dim fsOut 
             Logfile = Logpath & "AccountCreation.log" 
             Set fs = CreateObject("Scripting.FileSystemObject") 
             Set fsOut = fs.OpenTextFile(LogFile, ForAppending, True) 
             fsOut.WriteLine (strMessage) 
             fsOut.Close 
             End Sub 
             Function DateToStr() 
             DateToStr = DatePart("d",Now) & "/" & DatePart("m",Now) & "/" & DatePart("yyyy",Now) 
             End Function 
             
             ' ## Reloads Page on pressing [Clear Form] ## 
             Sub Reload 
             Location.Reload(True) 
             End Sub 
             
             ' ## Closes page on pressing [Exit] ## 
             Sub CloseForm 
             Window.Close 
             End Sub 'CloseForm 
             
             Sub About() 
             On Error Resume Next 
             strAbout="User Account Creation Form v2.0" & VbCrLf 
             strAbout= strAbout & "____________________________" & vbTab & VbCrLf & VbCrLf 
             strAbout=strAbout & " NHS Connecting For Health" & VbCrLf & VbCrLf 
             strAbout=strAbout & " Author: Darren Marsden" & VbCrLf 
             strAbout=strAbout & " Date: 31 July 2005" & vbcrlf & vbcrlf 
             strAbout= strAbout & "____________________________" & VbCrLf & VbCrLf 
             MsgBox strAbout,vbOKOnly+vbInformation,"About" 
             End Sub 
             </script> 
             </head> 
             
             <body> 
             <!-- Start Of Main Table --> 
             <table width="710" border="0" cellspacing="0" CellSpacing="0"> 
             <tr><td width="350" Valign="top"> 
             <!-- LHS Of Main Table --> 
             <table border="0" cellspacing="0" CellSpacing="0"> 
             <tr><td width="350"> 
             <!-- Username/Shortcode --> 
             <table border="0" cellspacing="0" CellSpacing="0" width="350"> 
             <tr><td valign="top" colspan="3"><fieldset><legend><b>Username/Shortcode</b></legend> 
             <table border="0" cellpadding="3" width="350"> 
             <tr><td width="110">Shortcode:</td><td><input type="text" 
             name="txtUser" style="width:195px"></td><td>&nbsp;</td></tr> 
             <tr><td>First Name: </td><td><input type="text" name="txtFirst" style="width:195px"></td><td 
             width="50">&nbsp;</td></tr> 
             <tr><td>Middle Initial: </td><td><input type="text" name="txtMiddle" style="width:195px"></td> 
             <td>(Optional)</td></tr> 
             <tr><td>Last Name: </td><td><input type="text" name="txtLast" style="width:195px"></td><td>&nbsp;</td></tr> 
             </table><p></fieldset></table> 
             <!-- End of Username/Shortcode --> 
             <!-- User Account Properties --> 
             <table border="0" cellpadding="0" cellspacing="0" width="350"> 
             <tr><td valign="top" colspan="3"><fieldset><legend><b>User Account Properties</b></legend> 
             <table border="0" cellpadding="3" width="350"> 
             <tr> 
             <td width="110">Job Title:</td><td><input type="text" name="txtTitle" style="width:195px"></td><td>&nbsp;</td> 
             </tr> 
             <tr><td>Office: </td> 
             <td align="right"> 
             <select size="1" name="cbxSite"> 
             <option value="Birmingham">Birmingham</option> 
             <option value="Exeter">Exeter</option> 
             <option value="Hatfield">Hatfield</option> 
             <option value="Leeds">Leeds</option> 
             <option value="Newcastle">Newcastle</option> 
             <option value="Other">Other</option> 
             <option value="Oxford">Oxford</option> 
             <option value="Paddington">Paddington</option> 
             <option value="Portland">Portland House</option> 
             <option value="Redditch">Redditch</option> 
             <option value="Richmond">Richmond House</option> 
             <option value="Slough">Slough</option> 
             <option value="Tavistock">Tavistock House</option> 
             <option value="Winchester">Winchester</option> 
             <option selected value="cbxOfficeAlert">-- Select Users Office --</option> 
             </select></td> 
             <td>&nbsp;</td> 
             </tr> 
             <tr> 
             <td>Department: </td><td><input type="text" name="txtDepartment" style="width:195px"></td><td width="50">&nbsp;</td> 
             </tr> 
             <tr> 
             <td>Company: </td><td><input type="text" name="txtCompany" value="NHS Connecting For Health" style="width:195px"></td><td>&nbsp;</td> 
             </tr> 
             <tr> 
             <td>Manager: </td><td><input type="text" name="txtManager" style="width:195px" disabled="True"></td><td>(Optional)</td> 
             </tr> 
             </table><p></fieldset></table> 
             <!-- End of User Account Properties --> 
             <!-- Group Membership --> 
             <table border="0" cellspacing="0" CellSpacing="0" width="350"> 
             <tr> 
             <td valign="top" colspan="3"><fieldset><legend><b>Group Membership</b></legend> 
             <table border="0" cellpadding="3" width="350"> 
             <tr> 
             <td width="150"><b>Group Name</b></td><td width="200" align="middle">Select to add user to group(s)</td> 
             </tr> 
             <tr> 
             <td width="150">NPFIT (File Access)</td><td width="200" align="middle"><input type="checkbox" name="chkGrpOne" checked="true"></td> 
             </tr> 
             <tr> 
             <td width="150">Share - NPSO Files</td><td width="200" align="middle"><input type="checkbox" name="chkGrpTwo" checked="true"></td> 
             </tr> 
             <tr> 
             <td width="150">Shared Data &nbsp;&nbsp;<font size="3" color="red"><b>*</b></font></td><td width="200" align="middle"><input type="checkbox" name="chkGrpThree" disabled="true"></td> 
             </tr> 
             </table><p></fieldset></table> 
             <!-- End of Group Membership --> 
             <!-- End of LHS Of Main Table --> 
             </td></tr></table> 
             
             </td> 
             
             <td width="350" Valign="top"> 
             <!-- RHS Of Main Table --> 
             <table border="0" cellspacing="0" CellSpacing="0"> 
             <tr><td width="350"> 
             <!-- Create User Mail Account --> 
             <table border="0" cellspacing="0" CellSpacing="0" width="350"> 
             <tr><td valign="top" colspan="3"><fieldset><legend><b>User Mail Account</b></legend> 
             <table border="0" cellpadding="3" width="350"> 
             <tr> 
             <td width="300">Create user mailbox?</td><td width="50" align="middle"><input type="checkbox" name="chkExch" checked="true"></td> 
             </tr></table> 
             <table border="0" cellpadding="3" width="350"> 
             <tr> 
             <td width="125">Server/Mailstore: </td> 
             <td align="right"><select size="1" name="cbxExch"> 
             <option value="EXCHPEA2G">EXCHPE [ A2G ]</option> 
             <option value="EXCHPEH2M">EXCHPE [ H2M ]</option> 
             <option value="EXCHPEN2S">EXCHPE [ N2S ]</option> 
             <option value="EXCHPET2Z">EXCHPE [ T2Z ]</option> 
             <option value="EXCHAQ2A2G">EXCHAQ2 [ A2G ]</option> 
             <option value="EXCHAQ2H2M">EXCHAQ2 [ H2M ]</option> 
             <option value="EXCHAQ2N2S">EXCHAQ2 [ N2S ]</option> 
             <option value="EXCHAQ2T2Z">EXCHAQ2 [ T2Z ]</option> 
             <option value="ODINMS">ODIN</option> 
             <option selected value="cbxExchAlert">-- Select Server/Mailstore --</option> 
             </select></td> 
             </tr> 
             </table><p></fieldset></table> 
             <!-- End of Create User Mailbox --> 
             <!-- Add to Distribution Lists --> 
             <table border="0" cellspacing="0" CellSpacing="0" width="350"> 
             <tr><td valign="top" colspan="3"><fieldset><legend><b>Distribution Lists</b></legend> 
             <table border="0" cellpadding="3" width="350"> 
             <tr> 
             <td width="300">Add user to Distribution List?</td><td width="50" align="middle"><input type="checkbox" name="chkDL" disabled="true"></td> 
             </tr></table> 
             <table border="0" cellpadding="3" width="350"> 
             <tr><td width="125">Distribution List: &nbsp;&nbsp;<font size="3" color="red"><b>*</b></font></td> 
             <td align="right"><select size="1" name="cbxDL" disabled="true"> 
             <option value="DLBirmingham">Aqueous II</option> 
             <option value="DLExeter">DL Exeter</option> 
             <option value="DLOxford">DL Oxford</option> 
             <option value="DLPortland ">DL Portland</option> 
             <option value="DLHatfield">DL Hatfield</option> 
             <option value="DLHuntingdon">DL Huntingdon</option> 
             <option value="DLNewcastle">DL Newcastle</option> 
             <option value="DLPaddington">DL Paddington</option> 
             <option value="DLSlough">DL Slough</option> 
             <option value="DLTavistock">DL Tavistock House</option> 
             <option selected value="cbxDLAlert">-- Select Distribution List --</option> 
             </select></td> 
             </tr> 
             </table><p></fieldset></table> 
             <!-- End of Add to Distribution Lists --> 
             <!-- Create User Home Directory --> 
             <table border="0" cellspacing="0" CellSpacing="0" width="350"> 
             <tr><td valign="top" colspan="3"><fieldset><legend><b>User Home Directory</b></legend> 
             <table border="0" cellpadding="3" width="350"> 
             <tr> 
             <td width="300">Create User Home Directory?</td><td width="50" align="middle"> 
             <input type="checkbox" name="chkUserFolder" checked="true"> 
             </td></tr> 
             </table><p></fieldset></table> 
             <!-- End Of Create User Home Directory --> 
             <!-- Enable Logging --> 
             <table border="0" cellspacing="0" CellSpacing="0" width="350"> 
             <tr><td valign="top" colspan="3"><fieldset><legend><b>Enable Logging</b></legend> 
             <table border="0" cellpadding="3" width="350"> 
             <tr> 
             <td width="300">Enable Logging?</td><td width="50" align="middle"> 
             <input type="checkbox" name="chkLogging" checked="true"> 
             </td></tr> 
             </table><p></fieldset></table> 
             <!-- End Of Enable Logging --> 
             <table border="0" cellspacing="0" cellpadding="0" width="350" height="147"> 
             <tr> 
             <td valign="top"> 
             <!-- Blank Table for future additions/features --> 
             &nbsp;<b>NOTE:</b> Items marked with <font size="3" color="red"><b>*</b></font> are disabled until the migration is complete. 
             </td></tr> 
             </table> 
             <table border="0" cellspacing="0" cellpadding="0" width="350"> 
             <tr> 
             <td align="right" valign="bottom"> 
             <input type="button" value=" About " onclick="About"> 
             <input type="button" value="Clear Form" onclick="Reload" title=" Click to Clear Form "> 
             <input type="button" value=" Submit " onClick="CreateAccount" title=" Click to Create User Account "> 
             <input type="button" value=" Exit " onclick="CloseForm" title=" Click to Exit Form "> 
             </td></tr> 
             </table> 
             <!-- End of RHS Of Main Table --> 
             </td></tr></table> 
             </td></tr></table> 
             <!-- End Of Main Table --> 
             </body> 
             </html> 
            <message edited by shanfont on Tuesday, February 27, 2007 7:07 AM>
             
              sshinn

              • Total Posts : 1
              • Scores: 0
              • Reward points : 0
              • Joined: 7/25/2007
              • Status: offline
              RE: Re: Create User Script Wednesday, July 25, 2007 1:32 PM (permalink)
              0
              This thread has been a fantasctic resource for me.. I have my own modified version of the script in this thread working perfectly..
               
              I am curious about the drop down menus you mentioned below in your script..
               
              I would like to add one drop down list for an OU path called departments, under that OU the drop list would show all of the OUs there, ie.. Human Resources, Accounting, Marketing, etc..
               
              and then based on the OU selected, display a list of security groups that are listed under that OU.. Say if Human resources was selected, there would be a second drop down displaying HR Director, HR Manager, ,etc
               
              That way when i creat a new user I could drop them in the proper OU and Security group along with all the great stuff this script does..
               
              Is this possible??
               
              Thanks,
              Sam
               

              ORIGINAL: esnmb

              I've expanded it many times over since I posted my code originally. My HTA stands at 1104 lines of code now...

              Once you learn how to do it, you will find it pretty fun to add stuff to make it more like an application.

              I have multi-select drop downs, check boxes to create home folders and mailboxes, sends HTML emails with a summary of everything, as well as a toned down email for an alternative manager email address that can be added. It's fun doing this since I'm a Network Engineer and not a developer so it's a good change of pace.

              Matt

               
                d_in_nc

                • Total Posts : 1
                • Scores: 0
                • Reward points : 0
                • Joined: 8/27/2008
                • Status: offline
                RE: Re: Create User Script Wednesday, August 27, 2008 9:10 AM (permalink)
                0
                I know its been a while since the last post of this topic, just wanted to say first off this script has been great, made my own modifications to it, good work CJ
                 
                I was wondering if any one has created the Termination script such as this, with a few ideas to look for
                Moving Account to new OU
                Reset Password
                Remove User from all Groups
                Rename Certain fields in thier AD Profile
                Hide from GAL
                Forward EMails to new User
                 
                Any Help to get me started with that would be Great.
                 
                Thanks
                 
                  dm_4ever

                  • Total Posts : 3687
                  • Scores: 82
                  • Reward points : 0
                  • Joined: 6/29/2006
                  • Location: Orange County, California
                  • Status: offline
                  RE: Re: Create User Script Wednesday, August 27, 2008 9:32 AM (permalink)
                  0
                  I actually created something that did a lot of the things you mentioned...I'll have to see if I can find it though....it was several years ago....however you should easily be able to create one of your own just by looking at examples from MS. 

                  http://www.microsoft.com/technet/scriptcenter/scripts/ad/default.mspx
                  dm_4ever

                  My philosophy: K.I.S.S - Keep It Simple Stupid
                  Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
                  Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
                   
                    jswift17

                    • Total Posts : 3
                    • Scores: 0
                    • Reward points : 0
                    • Joined: 11/5/2008
                    • Status: offline
                    RE: Re: Create User Script Wednesday, November 05, 2008 5:38 AM (permalink)
                    0
                    First off, great topic and great script.
                     
                    I was wondering if anyone would be willing to post their most recent version of this script?  I'm new to scripting and I'm working through all of this one line at a time (trying to figure out what does what).  I really like the layout and have been working to customize it fit our needs.
                     
                    I'm currently working on setting this script up so that our user creation process is more standardized (so everyone is creating users the same way).  I've got a small VBScript that does this now, but our helpdesk users don't like how the input boxes come up and are therefore less apt to use it.  If I can give them something "flashy" then I think it will catch on and they'll start using this script (and the HTA makes the script "flashy", even though it doesn't change what the script does).
                     
                    dm_4ever, did you ever find the termination script you mentioned in your post?  I think it would fit nicely with this user creation script and help to standardize this process as well.  I went out to the microsoft technet site you mentioned, but all of those scripts require that the information be hard coded into them, so we would have to change the script itself for each individual user (that would take forever and a day and I don't have the time (the boss is putting me under some serious pressure to get this done)).
                     
                    If anyone out there would be willing to post scripts they use for user creation/termination, I would sure appreciate it (and I'm sure there are others out there who would appreciate it as well).
                     
                    Thanks!!
                     
                    JS
                     
                      ThePariah

                      • Total Posts : 38
                      • Scores: 2
                      • Reward points : 0
                      • Joined: 6/14/2005
                      • Location: United Kingdom
                      • Status: offline
                      RE: Re: Create User Script Wednesday, November 05, 2008 7:26 AM (permalink)
                      0
                      Hey,

                      I posted something a long time ago, but i have developed and improved it considerably since.

                      Its dynamic and all data is popluted by querying AD (No hard coding at all so completely portable)

                      Ive even included the roaming profiles, and home drive options. Its a tabbed HTA.

                      Ive also added the ability to create multiple user accounts with a CSV.

                      Im away for the next 10 days but when i have sanitised it i will post it. Please check back.
                       
                        jswift17

                        • Total Posts : 3
                        • Scores: 0
                        • Reward points : 0
                        • Joined: 11/5/2008
                        • Status: offline
                        RE: Re: Create User Script Wednesday, January 07, 2009 4:20 AM (permalink)
                        0
                        I don't want to be a bother, but, were you able to dig up your script (and would you be willing to post the final code)?
                         
                        Thanks!
                         
                          jswift17

                          • Total Posts : 3
                          • Scores: 0
                          • Reward points : 0
                          • Joined: 11/5/2008
                          • Status: offline
                          RE: Re: Create User Script Monday, February 09, 2009 4:22 AM (permalink)
                          0
                          Still out here (if you happen to dig up your script).  I'm still very interested in taking a look at it (especially since we just completed an AD domain consolidation and having a standard tool/script to create users with would be very beneficial.
                           
                            chiching

                            • Total Posts : 4
                            • Scores: 0
                            • Reward points : 0
                            • Joined: 6/8/2011
                            • Status: offline
                            Re: Re: Create User Script Wednesday, June 08, 2011 8:50 PM (permalink)
                            0
                            You're welcome. BTW,Calgary Escort how far back do you suggest answering Calgary Escortssome of these posted problems?Calgary Asian Escorts See a lot of unanswered ones going way back.Calgary Asian Escort
                             
                            You're welcome. BTW,Calgary Asian Escorts how far back do you suggest answeringCalgary Asian Escort some of these posted problems?Calgary Escort See a lot of unanswered ones going way back.Calgary Escorts
                             
                            You're welcome. BTW,Edmonton Asian Escort how far back do you suggest answering Edmonton Escortsome of these posted problems? Edmonton EscortsSee a lot of unanswered ones going way back. Edmonton Asian Escorts
                             
                              chiching

                              • Total Posts : 4
                              • Scores: 0
                              • Reward points : 0
                              • Joined: 6/8/2011
                              • Status: offline
                              Re: Re: Create User Script Wednesday, June 08, 2011 8:51 PM (permalink)
                              0
                              You're welcome.BTW, Bike Trial SellerSeller[/URL] how far back do you suggest answeringBike Shop some of these posted problems? Bike StoreSee a lot of Bike Trials unanswered ones going way back.
                               
                              Would it be allright sf asian escortsif I would create JUST one post with all my work to show my progress within time ?sf escortsAnd should that be done in the WIP section ?sf asian escortAnd how often should I update it ?sf escort
                               
                              It took us about 6 monthssf asian escort to get almost 500 pages. Let's go for 5 months this time.sf escorts"It had to be said. The world is perishing from an orgy of self-sacrificing." - Howard Roarksf escort Dean Koontz= Always working!sf asian escorts
                               
                                chiching

                                • Total Posts : 4
                                • Scores: 0
                                • Reward points : 0
                                • Joined: 6/8/2011
                                • Status: offline
                                Re: Re: Create User Script Wednesday, June 08, 2011 8:53 PM (permalink)
                                0
                                Parking and reversing maneuvering are important skills.Seattle Asian Escorts Besides the highly annoying damages of failed backing maneuvers and the total financial losses,Seattle Asian Escort there is a connection between such light collisions and the harder collisionsSeattle Escort -- avoiding scrubbing other cars in the parking space helps avoiding more severe crashes on theSeattle Escorts road!
                                 
                                The ways inSeattle Asian Escorts which proper parkingSeattle Asian Escort maneuvers can be done have been stressed here nicely,Seattle Escorts and I will Seattle Escortonly add a few important notes. First, it's possible to practice with cones or some other kind of simulation. In advanced driving courses we found this method highly useful. Another important note is to use your mirrors!
                                 
                                i have been usingNew York Escorts windows media player calssicwhen you New York Escortselect the full screen reoslution as 320 x200 i figured that even though it still uses 16bpp colour depth it might be easier New York Asian Escortto capture using debut screen cast from this lower resolution and then use virtual dubNew York Asian Escorts
                                 
                                 
                                  chiching

                                  • Total Posts : 4
                                  • Scores: 0
                                  • Reward points : 0
                                  • Joined: 6/8/2011
                                  • Status: offline
                                  Re: Re: Create User Script Wednesday, June 08, 2011 8:54 PM (permalink)
                                  0
                                  You're welcome. BTW,Winnipeg Escort how far back do you suggestWinnipeg Asian Escort answering some of these posted problems?Winnipeg Asian Escorts See a lot of unanswered ones going way back.Winnipeg Escorts
                                   
                                  You're welcome. BTW,Red Deer Escorts how far back do you suggestRed Deer Escort answering some of these posted problems?Red Deer Asian Escort See a lot of unanswered ones going way back.Red Deer Asian Escorts
                                   
                                  You're welcome. BTW,Edmonton Escort how far back do you suggestEdmonton Asian Escort answering some of these posted problems?Edmonton Escorts See a lot of unanswered ones going way back.Edmonton Asian Escorts
                                   
                                    cjwallace

                                    • Total Posts : 549
                                    • Scores: 0
                                    • Reward points : 0
                                    • Joined: 3/5/2005
                                    • Location: United Kingdom
                                    • Status: offline
                                    Re: Re: Create User Script Monday, March 05, 2012 5:08 AM (permalink)
                                    0
                                    Guys.
                                    Really pleased that this script has helped some of you along on your vbscript journey. It was a joy to make along with all the fantastic help i got here.
                                     
                                    happy scripting
                                     
                                    www.wallacetech.co.uk
                                     

                                      Online Bookmarks Sharing: Share/Bookmark
                                      Change Page: < 123456789 | Showing page 9 of 9, messages 161 to 178 of 178

                                      Jump to:

                                      Current active users

                                      There are 0 members and 1 guests.

                                      Icon Legend and Permission

                                      • New Messages
                                      • No New Messages
                                      • Hot Topic w/ New Messages
                                      • Hot Topic w/o New Messages
                                      • Locked w/ New Messages
                                      • Locked w/o New Messages
                                      • Read Message
                                      • Post New Thread
                                      • Reply to message
                                      • Post New Poll
                                      • Submit Vote
                                      • Post reward post
                                      • Delete my own posts
                                      • Delete my own threads
                                      • Rate post

                                      2000-2012 ASPPlayground.NET Forum Version 3.9