Login | |
|
 |
RE: Re: Create User Script - 7/28/2005 4:05:59 AM
|
|
 |
|
| |
Snipah
Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
CJWallace, You can put the Window.MoveTo(x,y) in the logon.htm, but you must comment out the following in your VBS .Top = (IE.Document.ParentWindow.Screen.AvailHeight - IE.Height) / 2 .Left = (IE.Document.ParentWindow.Screen.AvailWidth - IE.Width) / 2 or else it will be overruled.... you can add the following to logon.htm <script language="JavaScript"> <!-- Window.MoveTo(500,600) //--> </script>
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: Re: Create User Script - 7/29/2005 7:38:49 AM
|
|
 |
|
| |
cjwallace
Posts: 491
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
|
Hello guys. Sorry i am being an arse and cant seem to get the hta to open in the middle of the screen. Whare are you putting it to make it open in the middle of the screen? Sorry i am just being an arse The script so far ============================================== <html> <HTA:APPLICATION APPLICATIONNAME="Withers LLP AD Account Creation" SCROLL="no" SINGLEINSTANCE="yes" WINDOWSTATE="normal" > <head> <title>Withers LLP 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> <script type="text/vbscript"> 'This section is the error reporting for the application Sub CreateAccount strUser = TextBox0.Value If strUser = "" Then MsgBox "You're missing required fields.",64, "Alert" Exit Sub End If strFirst = TextBox1.Value If strFirst = "" Then MsgBox "You're missing required fields",64, "Alert" Exit Sub End If strInitial = TextBox2.Value strLast = TextBox3.Value If strLast = "" Then MsgBox "You're missing required fields",64, "Alert" Exit Sub End If strDisplay = strFirst & ", " & strLast strCN = strFirst & "\, " & strLast Const ADS_UF_ACCOUNTDISABLE = 2 Const ADS_PROPERTY_UPDATE = 2 ' This section will create the user & set part of the General Page. Set objOU = GetObject("LDAP://OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") Set objUser = objOU.Create("User", "cn=" & strCN) objUser.Put "sAMAccountName", LCase(strUser) objUser.Put "userPrincipalName", strUser & "@withers.net" objUser.SetInfo objUser.Put "givenName", strFirst If strInitial <> "" Then objUser.Put "initials", strInitial End If objUser.Put "sn", strLast objUser.Put "displayName", strDisplay ' This section will assign the user a standard password objUser.SetPassword "Passw0rd" 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 ' Address Page Information Set objUser = GetObject _ ("LDAP://cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objUser.Put "streetAddress", "16 Old Bailey" objUser.Put "l", "London" objUser.Put "postalCode", "EC4M 7EG" objUser.Put "c", "GB" objUser.SetInfo ' General Page Information objUser.Put "physicalDeliveryOfficeName", "London" objUser.Put "telephoneNumber", "+44 (0)20 7597" objUser.Put "mail", strFirst & "." & strLast & "@withersworldwide.com" objUser.Put "wWWHomePage", "http://www.withersworldwide.com" objUser.SetInfo ' Users Telephone Information objUser.Put "facsimileTelephoneNumber", "+44 (0)20 7597 6543" objUser.SetInfo ' Organization Information objUser.Put "department", "Corporate" objUser.Put "company", "Withers LLP" objUser.SetInfo 'This Section Will Add the user to the Withers standard Security Groups Const ADS_PROPERTY_APPEND = 3 Set objGroup = GetObject _ ("LDAP://cn=LN London Users,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.PutEx ADS_PROPERTY_APPEND, _ "member", Array("cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.SetInfo Set objGroup = GetObject _ ("LDAP://cn=LN Corporate,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.PutEx ADS_PROPERTY_APPEND, _ "member", Array("cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.SetInfo Set objGroup = GetObject _ ("LDAP://cn=LN GWArchive,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.PutEx ADS_PROPERTY_APPEND, _ "member", Array("cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.SetInfo ' Creates where the users Roaming Profile will be stored based on Checkbox selection. If CreateProfile.Checked = TRUE Then 'Action 1 ' Users Profile Information objUser.Put "profilePath", "\\Withers.net\dfsroot\GlobalProfiles\" & strUser & "" ElseIf CreateProfile.Checked = FALSE Then 'Action 2 ' Users Profile Information objUser.Put "profilePath", "\\LNFS01\Profiles$\" & strUser & "" End If ' Users Home Drive Information objUser.Put "homeDirectory", "\\LNFS01\Home$\" & strUser & "" objUser.Put "homeDrive", "H" objUser.SetInfo 'This Section will Create The Users Home Drive on \\lnfs01\home$ Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.CreateFolder("\\LNFS01\home$\" & strUser) 'This Section will give the user change NTFS permissions to their home drives. Set objShell = CreateObject("Wscript.Shell") strDest = "\\LNFS01\home$\" & strUser objShell.Run ("SetACL.exe -on """ & strDest & """ -ot file -actn ace " & "-ace ""n:WITHERS.net\" & strUser & ";p:change""") 'This Section will create the Groupwise Archive Folder on \\LNFS01\GWArchive$\%username% Set objFolder = objFSO.CreateFolder("\\LNFS01\GWArchive\" & strUser) ' Will Disbale User Account based on Checkbox selection. If DisableAccount.Checked Then ' Disables The User Account Set objUser = GetObject _ ("LDAP://cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo End If End Sub Sub Reload location.Reload(True) End Sub Sub bodyLoaded() window.ResizeTo 530,590 ' WIDTH, HEIGHT End Sub </script> </head> <body onLoad="bodyLoaded()"> <p class="style2" align="center"> <img border="0" src="withers.bmp" width="286" height="92"></p> <p class="style2" align="left"> CORPORATE DEPARTMENT</p> <p class="style2" align="left"> <font color="#CC6600">Creation Page User Options</font></p> <table width="286" border="0" align="left" height="59"> <tr> <td width="94" height="10"><span class="style5"><b>*</b></span>Login ID: </td> <td width="187" height="10"><input type="text" name="textbox0" size="23"></td> </tr> <tr> <td width="94" height="14"><span class="style5"><b>*</b></span>First Name:</td> <td width="187" height="14"><input type="text" name="textbox1" size="23"></td> </tr> <tr> <td width="94" height="13">Middle Initial: </td> <td width="187" height="13"><input type="text" name="textbox2" size="23"></td> </tr> <tr> <td width="94" height="1"><span class="style5"><b>*</b></span>Last Name: </td> <td width="187" height="1"><input type="text" name="textbox3" size="23"></td> </table> <table width="228" border="0" align="left" height="28"> <tr> <td width="191" height="1">Corporate Fee Earner? </td> <td width="28" height="1"><input type="checkbox" name="CreateProfile" value="CreateProfile"></td> </tr> <tr> <td width="191" height="1">Disable User Account? </td> <td width="28" height="1"><input type="checkbox" name="DisableAccount" value="DisableAccount"></td> </tr> </table> <br> <br> <br> <br> <p> <br> <br> <br> </p> <p> <input type="button" name="Submit" value="Submit" onClick="CreateAccount"> </p> <p>The new employee will also be required <br> to change their password at first logon. </p> <p class="style3"><b><span class="style6">*</span> </b> Indicates Required Field</p> <p> <input id="reloadbutton" class="button" type="reset" value="Clear Form" name="reload_button" onClick="Reload"> <font color="#CC6600" size="2">Script designed by Craig Wallace,<br> London Systems Analyst 30.05.05 v2</font> </p> <p> <input type="button" value=" Exit " name="close_button" onClick="Self.Close"> </p> </body> </html>
|
|
| |
|
|
|
 |
RE: Re: Create User Script - 7/29/2005 8:05:06 AM
|
|
 |
|
| |
Snipah
Posts: 1341
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
Hey there..... use this: Sub bodyLoaded() theleft = (screen.availWidth - document.body.clientWidth) / 2 thetop = (screen.availHeight - document.body.clientHeight) / 2 window.moveTo theleft,thetop End Sub
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: Re: Create User Script - 8/7/2005 11:40:36 PM
|
|
 |
|
| |
cjwallace
Posts: 491
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
|
What I would like to do is have another box on the main page for extension number and once a value is entered is will add it to objUser.Put "telephoneNumber", " " Can anyone help me with this, Many thanks in advance Below is the code so far. ============================== <html> <HTA:APPLICATION APPLICATIONNAME="Withers LLP AD Account Creation" SCROLL="no" SINGLEINSTANCE="no" WINDOWSTATE="normal" > <head> <title>Withers LLP User Account Creation Form</title> <style type="text/css"> <!-- .style3 {font-size: 13px} body, td { 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> <script type="text/vbscript"> 'This section is the error reporting for the application Sub CreateAccount strUser = TextBox0.Value If strUser = "" Then MsgBox "You're missing required fields.",64, "Alert" Exit Sub End If strFirst = TextBox1.Value If strFirst = "" Then MsgBox "You're missing required fields",64, "Alert" Exit Sub End If strInitial = TextBox2.Value strLast = TextBox3.Value If strLast = "" Then MsgBox "You're missing required fields",64, "Alert" Exit Sub End If strDisplay = strFirst & ", " & strLast strCN = strFirst & "\, " & strLast Const ADS_UF_ACCOUNTDISABLE = 2 Const ADS_PROPERTY_UPDATE = 2 ' This section will create the user & set part of the General Page. Set objOU = GetObject("LDAP://OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") Set objUser = objOU.Create("User", "cn=" & strCN) objUser.Put "sAMAccountName", LCase(strUser) objUser.Put "userPrincipalName", strUser & "@withers.net" objUser.SetInfo objUser.Put "givenName", strFirst If strInitial <> "" Then objUser.Put "initials", strInitial End If objUser.Put "sn", strLast objUser.Put "displayName", strDisplay ' This section will assign the user a standard password objUser.SetPassword "Passw0rd" 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 ' Address Page Information Set objUser = GetObject _ ("LDAP://cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objUser.Put "streetAddress", "16 Old Bailey" objUser.Put "l", "London" objUser.Put "postalCode", "EC4M 7EG" objUser.Put "c", "GB" objUser.SetInfo ' General Page Information objUser.Put "physicalDeliveryOfficeName", "London" objUser.Put "telephoneNumber", "0000" objUser.Put "mail", strFirst & "." & strLast & "@withersworldwide.com" objUser.Put "wWWHomePage", "http://www.withersworldwide.com" objUser.SetInfo ' Users Telephone Information objUser.Put "facsimileTelephoneNumber", "+44 (0)20 7597 6543" objUser.SetInfo ' Organization Information objUser.Put "department", "Corporate" objUser.Put "company", "Withers LLP" objUser.SetInfo 'This Section Will Add the user to the Withers standard Security Groups Const ADS_PROPERTY_APPEND = 3 Set objGroup = GetObject _ ("LDAP://cn=LN London Users,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.PutEx ADS_PROPERTY_APPEND, _ "member", Array("cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.SetInfo Set objGroup = GetObject _ ("LDAP://cn=LN Corporate,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.PutEx ADS_PROPERTY_APPEND, _ "member", Array("cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.SetInfo ' Creates where the users Roaming Profile will be stored based on Checkbox selection. If CreateProfile.Checked = TRUE Then ' Use DFS Share ' Users Profile Information objUser.Put "profilePath", "\\Withers.net\dfsroot\GlobalProfiles\" & strUser & "" ElseIf CreateProfile.Checked = FALSE Then ' Use File Server ' Users Profile Information objUser.Put "profilePath", "\\LNFS01\Profiles$\" & strUser & "" End If ' Users Home Drive Information objUser.Put "homeDirectory", "\\LNFS01\Home$\" & strUser & "" objUser.Put "homeDrive", "H" objUser.SetInfo 'This Section will Create The Users Home Drive on \\lnfs01\home$ Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.CreateFolder("\\LNFS01\home$\" & strUser) 'This Section will give the user change NTFS permissions to their home drives. Set objShell = CreateObject("Wscript.Shell") strDest = "\\LNFS01\home$\" & strUser objShell.Run ("SetACL.exe -on """ & strDest & """ -ot file -actn ace " & "-ace ""n:WITHERS.net\" & strUser & ";p:change""") 'This Section will create the Groupwise Archive Folder on \\LNFS01\GWArchive$\%username% & Add them to the GroupWise Security Group if GroupwiseUser.checked Then ' Creates GroupWise Achive Folder Set objFolder = objFSO.CreateFolder("\\LNFS01\GWArchive$\" & strUser) Set objGroup = GetObject _ ("LDAP://cn=LN GWArchive,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.PutEx ADS_PROPERTY_APPEND, _ "member", Array("cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") objGroup.SetInfo End if ' Will Disbale User Account based on Checkbox selection. If DisableAccount.Checked Then ' Disables The User Account Set objUser = GetObject _ ("LDAP://cn=" & strCN & ",OU=CORPORATE,OU=LONDON USERS,OU=WITHERS USERS,dc=withers,dc=net") intUAC = objUser.Get("userAccountControl") objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE objUser.SetInfo End If End Sub Sub Reload location.Reload(True) End Sub Sub bodyLoaded() theleft = (screen.availWidth - document.body.clientWidth) / 2 thetop = (screen.availHeight - document.body.clientHeight) / 2 window.moveTo theleft,thetop window.ResizeTo 550,560 ' WIDTH, HEIGHT End Sub </script> </head> <body onLoad="bodyLoaded()" style="background-attachment: fixed"> <p class="style2" align="center"> <img border="0" src="withers.bmp" width="286" height="92"></p> <p class="style2" align="left"> LONDON CORPORATE DEPARTMENT</p> <p class="style2" align="left"> <font color="#CC6600">Create User User Options</font></p> <table width="280" border="2" align="left" height="59"> <tr> <td width="93" height="10"><span class="style5"><b>*</b></span>Login ID: </td> <td width="169" height="10"><input type="text" name="textbox0" size="23"></td> </tr> <tr> <td width="93" height="14"><span class="style5"><b>*</b></span>First Name:</td> <td width="169" height="14"><input type="text" name="textbox1" size="23"></td> </tr> <tr> <td width="93" height="13">Middle Initial: </td> <td width="169" height="13"><input type="text" name="textbox2" size="23"></td> </tr> <tr> <td width="93" height="1"><span class="style5"><b>*</b></span>Last Name: </td> <td width="169" height="1"><input type="text" name="textbox3" size="23"></td> </table> <table width="239" border="2" align="left" height="80"> <tr> <td width="194" height="24">Corporate Fee Earner? </td> <td width="27" height="24"><input type="checkbox" name="CreateProfile" value="CreateProfile"></td> </tr> <tr> <td width="194" height="25">GroupWise User?</td> <td width="27" height="25"> <input type="checkbox" name="GroupwiseUser" value="GroupwiseUser"></td> </tr> <tr> <td width="194" height="25">Disable User Account? </td> <td width="27" height="25"><input type="checkbox" name="DisableAccount" value="DisableAccount"></td> </tr> </table> <p><br> <br> <br> <br> <br> <br> </p> <p> <input type="button" name="Submit" value="Submit" onClick="CreateAccount"> </p> <p class="style3"><b><span class="style6">*</span> </b> Indicates Required Field</p> <p> <input id="reloadbutton" class="button" type="reset" value="Clear Form" name="reload_button" onClick="Reload"> <font color="#CC6600" size="2">Script designed by Craig Wallace,<br> London Systems Analyst 30.05.05 v3</font> </p> <p> <input type="button" value=" Exit " name="close_button" onClick="Self.Close"> </p> </body> </html>
|
|
| |
|
|
|
 |
RE: Re: Create User Script - 8/8/2005 9:21:50 AM
|
|
 |
|
| |
ThePariah
Posts: 15
Score: 0
Joined: 6/14/2005
From: United Kingdom
Status: offline
|
<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&q | | |