| |
cjwallace
Posts: 491
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
|
My next issue. Please see the section in bold. I dont want the person using the script to not beable to proceed with out entering a password. at the moment when the script arrives at the password point if you click cancel the script will just fail. I was thinking about looping it but i am not sure at which point to loop. i just want to make them enter a password The script so far ============================ <HTML> <HEAD> <TITLE>HTA Application Template</TITLE> <HTA:APPLICATION ID="MyApp" APPLICATIONNAME="ASE Application Template" BORDER="thick" BORDERSTYLE="complex" CAPTION="yes" CONTEXTMENU="no" ICON="http://Your URL/your icon.ico" INNERBORDER="yes" MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes" NAVIGABLE="no" SCROLL="no" SHOWINTASKBAR="yes" SINGLEINSTANCE="no" SYSMENU="yes" VERSION="1.0" WINDOWSTATE="maximized"/> <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 Language="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", " " objUser.Put "mail", strFirst & "." & strLast & "@withersworldwide.com" objUser.Put "wWWHomePage", "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 - London" 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 ' Will Create Elite SQL Account based on Checkbox selection. If CreateSQL.Checked Then ' Creates The Elite SQL Account Set db = CreateObject("ADODB.Connection") cnstring = "Provider=SQLOLEDB.1;Password=Waterl00;Persist Security Info=True;User ID=sa;Initial Catalog=Chris;Data Source=10.10.100.62" db.open cnstring Dim objPassDlg Set objPassDlg = CreateObject("PassDlg.PasswordDialog") objPassDlg.AllowBlankPassword = False objPassDlg.Confirm = True objPassDlg.ShowDialog "Enter Elite Password" If objPassDlg.Canceled Then MsgBox "You have declined to enter a password" Else MsgBox "WILL ENTER EMAIL TEXT WHEN NEEDED" End If db.Execute "exec sp_addlogin @loginame=" & strUser & ",@passwd=" & objPassDlg.password & ",@defdb='Chris',@deflanguage='British'" db.Execute "use chris exec sp_grantdbaccess "& strUser &" " db.Execute "exec sp_addrolemember 'Elite', " & strUser &" " 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">Create Elite SQL Account? </td> <td width="27" height="25"><input type="checkbox" name="CreateSQL" value="CreateSQL"></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>
< Message edited by cjwallace -- 10/28/2005 2:01:40 AM >
|
|