Windows PE doesn’t include the .Net framework – so that neat app your just wrote can be flushed. Or is it a waste? What if we converted it to an HTA? Here’s a slab that takes input from a GUI and sets up scripts to load servers.
<HTA:APPLICATION id="oDPBS" applicationname="DiskPartBootStrapper" border="thin" borderstyle="complex" caption="yes" contextmenu="no" selection="no" showintaskbar="yes" singleinstance="no" sysmenu="yes" scroll="auto" maximizebutton="yes" minimizebutton="yes" windowstate="normal" icon="myicon.ico" > <html> <head> <title>Server Builder</title> <style type="text/css"> <!-- body { filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#ffffcc', EndColorStr='#adc3db'); border: 0; xfont-family: "Verdana, Arial, Helvetica, sans-serif"; font:menu; color:menutext; xfont-size: 8pt; background-color: #ffffdd; background-position: top left; background-repeat: no-repeat; cursor:default; } input { background: #f5f5dc; font-family: verdana; font-size: 8pt; } textarea { background: #f5f5dc; font-family: verdana; font-size: 8pt; } select { background: #f5f5dc; font-family: verdana; font-size: 8pt; } td { font-family: verdana; font-size: 8pt; text-align: left; text-decoration: none; vertical-align: top; } --> </style> <script language="vbscript"> VersionNbr = "1.0" ScriptLocation = Right(document.location, Len(document.location) - 8 ) ScriptLocation = Replace(ScriptLocation, "/", "\") ScriptModified = document.lastmodified document.title = document.title & " (v" & VersionNbr & ")" Dim objFSO, objFile, objShell Dim OSstring 'used for both Dim objDiskPartFile Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") Const ForWriting = 2 Dim TmplScriptLoc, DiskPartFile TmplScriptLoc = "x:\diskpart.txt" DiskPartFile = "x:\install.bat" Dim numericCheck Dim Regzing Private Sub Window_onLoad window.resizeTo 425,225 End Sub Private Sub Button1Click If IsNumeric(TextBox1.value) Then RunProcess Else MsgBox("Please specify the size of the C: partition in GB") End If End Sub Sub RunProcess Select Case ComboBox1.value Case "Windows 2003 Web Edition x86" Regzing = 1 Case "Windows 2003 Standard Edition x86" Regzing = 1 Case "Windows 2003 Standard Edition x64" Regzing = 1 Case "Windows 2003 Enterprise Edition x86" Regzing = 1 Case "Windows 2003 Enterprise Edition x64" Regzing = 1 Case Else Regzing = 0 End Select 'Math = GB to MB conversion Dim Math Math = TextBox1.value * 1024 'Diskpart template script Dim Diskpart Diskpart = "Select 0" & vbCrLf _ & "clean" & vbCrLf & _ & "create partition primary size = " & Math & vbCrLf _ & "active" & vbCrLf _ & "assign letter = c" & vbCrLf _ & "exit" Set objFile = objFSO.OpenTextFile(TmplScriptLoc, ForWriting, True) objFile.WriteLine Diskpart objFile.Close 'Write script for Windows 2003 If Regzing = 1 Then 'Prepare Disk OSstring = "regedit /s x:\support\REGTWEAKZ.reg > NUL" & vbCrLf _ & "diskpart -s x:\diskpart.txt > NUL" & vbCrLf _ & "format c: /q /y /v:OS /fs:NTFS > NUL" & vbCrLf _ & "x:\support\bootsect.exe /NT52 all > NUL" & vbCrLf _ & "xcopy /e z:\" & combobox1.value & "\$OEM$\$1\* c:\ > NUL" & vbCrLf _ & "z:\" & combobox1.value & "\I386\WINNT32.exe /unattend:z:\" & combobox1.value & "\I386\complete.sif" & vbCrLf & _ & "exit" Else OSstring = "diskpart -s x:\diskpart.txt" & vbCrLf _ & "format c: /q /y /v:OS /fs:NTFS > NUL" & vbCrLf _ & "x:\support\bootsect.exe /NT60 all > NUL" & vbCrLf _ & "x:\process\setup.exe /wds /wdsdiscover /wdsserver:206.222.3.66 /unattend" & combobox1.value End If Set objDiskPartFile = objFSO.OpenTextFile(DiskPartFile, ForWriting, True) objDiskPartFile.WriteLine OSstring objDiskPartFile.Close End Sub Sub AboutButtonClick msgbox "Location: " & ScriptLocation & vbcrlf & vbcrlf & "Version: " & VersionNbr & vbcrlf & vbcrlf & "Modified: " & ScriptModified, vbInformation + vbOKonly, "About the Script" End Sub </script> </head> <body> <table width="100%" border="0" cellpadding="3" cellspacing="3"> <tr> <td>Operating System:</td> <td> <select name="combobox1"> <option value="web32">Windows 2003 Web Edition x86</option> <option value="std32">Windows 2003 Standard Edition x86</option> <option value="std64">Windows 2003 Standard Edition x64</option> <option value="ent32">Windows 2003 Enterprise Edition x86</option> <option value="ent64">Windows 2003 Enterprise Edition x64</option> <option value="2k8webx86.xml">Windows 2008 Web Edition x86</option> <option value="2k8webx64.xml">Windows 2008 Web Edition x64</option> <option value="2k8dcx86.xml">Windows 2008 Datacenter Edition x86</option> <option value="2k8dcx64.xml">Windows 2008 Datacenter Edition x64</option> </select> </td> </tr> <tr> <td>Disk Space:</td> <td><input type="text" name="textbox1" value="10240"></td> </tr> <tr> <td colspan="2"><input type="button" value="Generate" onclick="Button1Click" style="width:90" /></td> </tr> <tr> <td colspan="2"><hr /></td> </tr> <tr> <td><input type="button" value="About" onclick="AboutButtonClick" style="width:90" /></td> <td><input type="button" value="Quit" onclick="javascript:window.close();" style="width:90" /></td> </tr> </table> </body> </html>