Advertisement
Guest User

lurkinwh

a guest
Oct 25th, 2013
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Computer Deployment</title>
  4. <HTA:APPLICATION
  5. ID="objCompDeploy"
  6. APPLICATIONNAME="Computer Deployment"
  7. SCROLL="no"
  8. SINGLEINSTANCE="yes"
  9. maximizeButton="no"
  10. minimizeButton="no"
  11. sysMenu="no"
  12. >
  13. </head>
  14. <SCRIPT LANGUAGE="VBScript">
  15.  
  16. Set WshShell = CreateObject("Wscript.Shell")
  17.  
  18. Sub Window_onLoad
  19. window.resizeTo 450,400
  20. End Sub
  21.  
  22. Sub modUnattend
  23.  
  24. run_button.Disabled = True
  25.  
  26. Set fso = CreateObject("Scripting.FileSystemObject")
  27.  
  28. base = Wshshell.ExpandEnvironmentStrings("%SystemRoot%")
  29. unattendFile = base & "\Panther\unattend.xml"
  30.  
  31.  
  32. computerName = ComputerNameArea.Value
  33. WorkgroupName = WorkgroupNameArea.Value
  34. domainName = DomainNameArea.Value
  35. userName = UserNameArea.Value
  36. domainAdminPass = PasswordArea.Value
  37. domainAdminPassConfirm = PasswordAreaConfirm.Value
  38. OUName = OUNameArea.Value
  39.  
  40.  
  41. if not domainAdminPass = domainAdminPassConfirm then
  42. msgbox("The passwords do not match.")
  43. run_button.Disabled = False
  44. exit sub
  45. end if
  46.  
  47. Set xmlDoc = CreateObject("Microsoft.XMLDOM")
  48. xmlDoc.load unattendFile
  49.  
  50. 'Iterate through Unattend.xml searching for nodes and properties to replace
  51. Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/ComputerName")
  52. For each n in oNodes
  53. n.text = computerName
  54. xmlDoc.save unattendFile
  55. Next
  56.  
  57. Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/Credentials/Domain")
  58. For each n in oNodes
  59. n.text = domainName
  60. xmlDoc.save unattendFile
  61. Next
  62.  
  63. Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/Credentials/Password")
  64. For each n in oNodes
  65. n.text = domainAdminPass
  66. xmlDoc.save unattendFile
  67. Next
  68.  
  69. Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/Credentials/Username")
  70. For each n in oNodes
  71. n.text = userName
  72. xmlDoc.save unattendFile
  73. Next
  74.  
  75. Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/JoinDomain")
  76. For each n in oNodes
  77. n.text = domainName
  78. xmlDoc.save unattendFile
  79. Next
  80.  
  81. Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/JoinWorkgroup")
  82. For each n in oNodes
  83. n.text = WorkgroupName
  84. xmlDoc.save unattendFile
  85. Next
  86.  
  87. Set oNodes = xmlDoc.documentElement.selectNodes("/unattend/settings/component/Identification/MachineObjectOU")
  88. For each n in oNodes
  89. n.text = OUName
  90. xmlDoc.save unattendFile
  91. Next
  92.  
  93. 'launch the continuation of setup in a hidden window and wait for return
  94. 'if we dont wait, closing mshta, closes windeploy.exe
  95. WshShell.Run "%WINDIR%\System32\oobe\windeploy.exe", 0, True
  96. idTimer = window.setTimeout("closeHTA", 5000, "VBScript")
  97. End Sub
  98.  
  99. Sub closeHTA
  100. window.close
  101. End Sub
  102.  
  103. Sub commandLine
  104. WshShell.Run "%WINDIR%\System32\cmd.exe", 1, True
  105. End Sub
  106.  
  107. </SCRIPT>
  108. <body>
  109. <table border="0">
  110. <tr>
  111. <td>Computer Name:</td>
  112. <td><input type="text" name="ComputerNameArea" size="30" maxlength="15" value=""></td>
  113. </tr>
  114. <tr>
  115. <td>Workgroup:</td>
  116. <td><input type="text" name="WorkgroupNameArea" size="30" maxlength="15" value=""></td>
  117. </tr>
  118. <td>Domain Name:</td>
  119. <td><input type="text" name="DomainNameArea" size="30" value="domain.local"></td>
  120. </tr>
  121. <tr>
  122. <td>Container OU:</td>
  123. <td>
  124. <select size="1" name="OUNameArea">
  125. <option value="OU=someou,DC=domain,DC=local">Desktops</option>
  126. <option value="OU=someotherou,DC=domain,DC=local">Laptops</option>
  127. </select>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td>User Name:</td>
  132. <td><input type="text" name="UserNameArea" size="30"></td>
  133. </tr>
  134. <tr>
  135. <td>Password:</td>
  136. <td><input type="password" name="PasswordArea" size="30"></td>
  137. </tr>
  138. <tr>
  139. <td>Confirm Password:</td>
  140. <td><input type="password" name="PasswordAreaConfirm" size="30"></td>
  141. </tr>
  142. </table>
  143. <p align="right">
  144. <input id=runbutton class="button" type="button" value="Continue" name="run_button" onClick="modUnattend">
  145. <p align="center">
  146. Note: The following characters are invalid for use in the computer name: " `~!@#$%^&<span onClick="commandLine">*</span>()=+[]{}\|;:'",<>/?. "
  147. You will not recieve any warning regarding incorrectly supplied parameters during setup. If any of them are incorrect, setup completion
  148. may take a long time.
  149. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement