Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Computer Deployment</title>
- <HTA:APPLICATION
- ID="objCompDeploy"
- APPLICATIONNAME="Computer Deployment"
- SCROLL="no"
- SINGLEINSTANCE="yes"
- maximizeButton="no"
- minimizeButton="no"
- sysMenu="no"
- >
- </head>
- <SCRIPT LANGUAGE="VBScript">
- Set WshShell = CreateObject("Wscript.Shell")
- Sub Window_onLoad
- window.resizeTo 450,400
- End Sub
- Sub modUnattend
- run_button.Disabled = True
- Set fso = CreateObject("Scripting.FileSystemObject")
- base = Wshshell.ExpandEnvironmentStrings("%SystemRoot%")
- unattendFile = base & "\Panther\unattend.xml"
- computerName = ComputerNameArea.Value
- WorkgroupName = WorkgroupNameArea.Value
- domainName = DomainNameArea.Value
- userName = UserNameArea.Value
- domainAdminPass = PasswordArea.Value
- domainAdminPassConfirm = PasswordAreaConfirm.Value
- OUName = OUNameArea.Value
- if not domainAdminPass = domainAdminPassConfirm then
- msgbox("The passwords do not match.")
- run_button.Disabled = False
- exit sub
- end if
- Set xmlDoc = CreateObject("Microsoft.XMLDOM")
- xmlDoc.load unattendFile
- 'Iterate through Unattend.xml searching for nodes and properties to replace
- Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/ComputerName")
- For each n in oNodes
- n.text = computerName
- xmlDoc.save unattendFile
- Next
- Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/Credentials/Domain")
- For each n in oNodes
- n.text = domainName
- xmlDoc.save unattendFile
- Next
- Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/Credentials/Password")
- For each n in oNodes
- n.text = domainAdminPass
- xmlDoc.save unattendFile
- Next
- Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/Credentials/Username")
- For each n in oNodes
- n.text = userName
- xmlDoc.save unattendFile
- Next
- Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/JoinDomain")
- For each n in oNodes
- n.text = domainName
- xmlDoc.save unattendFile
- Next
- Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/JoinWorkgroup")
- For each n in oNodes
- n.text = WorkgroupName
- xmlDoc.save unattendFile
- Next
- Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/MachineObjectOU")
- For each n in oNodes
- n.text = OUName
- xmlDoc.save unattendFile
- Next
- 'launch the continuation of setup in a hidden window and wait for return
- 'if we dont wait, closing mshta, closes windeploy.exe
- WshShell.Run "%WINDIR%\System32\oobe\windeploy.exe", 0, True
- idTimer = window.setTimeout("closeHTA", 5000, "VBScript")
- End Sub
- Sub closeHTA
- window.close
- End Sub
- Sub commandLine
- WshShell.Run "%WINDIR%\System32\cmd.exe", 1, True
- End Sub
- </SCRIPT>
- <body>
- <table border="0">
- <tr>
- <td>Computer Name:</td>
- <td><input type="text" name="ComputerNameArea" size="30" maxlength="15" value=""></td>
- </tr>
- <tr>
- <td>Workgroup:</td>
- <td><input type="text" name="WorkgroupNameArea" size="30" maxlength="15" value=""></td>
- </tr>
- <td>Domain Name:</td>
- <td><input type="text" name="DomainNameArea" size="30" value="domain.local"></td>
- </tr>
- <tr>
- <td>Container OU:</td>
- <td>
- <select size="1" name="OUNameArea">
- <option value="OU=someou,DC=domain,DC=local">Desktops</option>
- <option value="OU=someotherou,DC=domain,DC=local">Laptops</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>User Name:</td>
- <td><input type="text" name="UserNameArea" size="30"></td>
- </tr>
- <tr>
- <td>Password:</td>
- <td><input type="password" name="PasswordArea" size="30"></td>
- </tr>
- <tr>
- <td>Confirm Password:</td>
- <td><input type="password" name="PasswordAreaConfirm" size="30"></td>
- </tr>
- </table>
- <p align="right">
- <input id=runbutton class="button" type="button" value="Continue" name="run_button" onClick="modUnattend">
- <p align="center">
- Note: The following characters are invalid for use in the computer name: " `~!@#$%^&<span onClick="commandLine">*</span>()=+[]{}\|;:'",<>/?. "
- You will not recieve any warning regarding incorrectly supplied parameters during setup. If any of them are incorrect, setup completion
- may take a long time.
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement