none
Winpe4 (Windows 8 based) custom shell RRS feed

  • General discussion

  • My goal is to customize a windows PE 4 boot image.  It must do the following.

    1. Do not display the command prompt window
    2. load a custom hta shell

    With winpe3 I managed to make it run without a command prompt and automatically load an hta file.  I did this by assigning a custom shell in x:\windows\system32\winpeshl.ini that points to bddrun.exe

    Contents of winpeshl.ini

    [LaunchApps]
    %SYSTEMROOT%\System32\bddrun.exe,/bootstrap

    Windows PE 4 created by using the new Assessment and Deployment kit no longer has bddrun.exe.  I've tried using other options, but this is the simplest way to get it to run winpeinit.exe so I have all the resources I need without it running a command window.  I ended up copying bddrun.exe from my winpe3 wim to the winpe4 wim and it works just fine.  I suspect that the copy on a windows 7 computer would be the same. 

    I then have an Unattend.xml file on the root of the X drive which does several things.  It runs bginfo.exe which is a free, third party tool which sets the background and displays other helpful info such as the IP address and Mac Address.  Then it runs menu.hta which is the real "shell". 

    contents of Unattend.xml

    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
                <Display>
                    <ColorDepth>16</ColorDepth>
                    <HorizontalResolution>1024</HorizontalResolution>
                    <RefreshRate>60</RefreshRate>
                    <VerticalResolution>768</VerticalResolution>
                </Display>
                <RunSynchronous>
    		<RunSynchronousCommand wcm:action="add">
                        <Description>Background</Description>
                        <Order>1</Order>
                        <Path>X:\BGInfo.exe /accepteula /timer:0 /iqX:\BackGroundSettings.bgi /silent</Path>
                    </RunSynchronousCommand>
                    <RunSynchronousCommand wcm:action="add">
                        <Description>PE Menu</Description>
                        <Order>2</Order>
                        <Path>mshta.exe x:\menu.hta</Path>
                    </RunSynchronousCommand>
                </RunSynchronous>
                <EnableFirewall>false</EnableFirewall>
            </component>
        </settings>
        <cpi:offlineImage cpi:source="wim://ccpxe/express/images/win7x64/district/originaldvd/sources/install.wim#Windows 7 ENTERPRISE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    

    Hopefully this will help someone create a custom windows pe menu system and hide the command window.  For more fun, I included the menu.hta below which is easily customizable to run the comands you want. Keep in mind that most of the options won't work unless you add a suitable ghost.exe and other utilites to your image in the path's the menu is expecting.

    contents of menu.hta

    <HTML>
     <HEAD>
        <TITLE>Welcome to Microsoft Windows PE</TITLE>
        <HTA:APPLICATION 
    	WINDOWSTATE="normal"
    	BORDER="none"
    	INNERBORDER="no"
    	SHOWINTASKBAR="no"
    	SCROLL="no"
    	APPLICATIONNAME="Windows PE Wizard"
    	NAVIGABLE="yes">
     </HEAD>
    <BODY>
    <SCRIPT LANGUAGE="VBScript">
    
    Sub Window_Onload
      strComputer = "."
      Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
      Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
      For Each objItem in colItems
        intHorizontal = objItem.ScreenWidth
        intVertical = objItem.ScreenHeight
      Next
      window.resizeTo 550,310
      window.moveTo 10, 10
    End Sub 
    
    FUNCTION Wipe()
    	SET WSHShell = CreateObject("WScript.Shell")
    	rc = msgbox ("This will perminently erase all data on the hard drive.  Continue?",260,"Erase Disk")
    	if rc = 6 then
    		WSHShell.Run "X:\Progra~1\wipe.exe -d1 -p1B -dod",,True
    		msgbox ("Disk erasure complete")
    	end if
    END FUNCTION
    
    FUNCTION Ghost71()
    	SET WSHShell = CreateObject("WScript.Shell")
    	rc = msgbox ("Map D204\Express Drives before Running Ghost?",4,"Map Drives")
    		if rc = 6 then
    		WSHShell.Run "x:\MapDrives71.cmd",,True    
    		set filesys=CreateObject("Scripting.FileSystemObject")
    		If Not filesys.FolderExists("I:\") Then
    			MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
    			Exit Function
    		end if
    	end if
    	WSHShell.Run "X:\Progra~1\Ghost\ghost32.exe"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION RDeploy71()
      SET WSHShell = CreateObject("WScript.Shell")
    	rc = msgbox ("Map D204\Express Drives before Running Rdeploy?",4,"Map Drives")
    		if rc = 6 then
    	  WSHShell.Run "x:\MapDrives71.cmd",,True    
    		set filesys=CreateObject("Scripting.FileSystemObject")
    		If Not filesys.FolderExists("I:\") Then
    			MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
    			Exit Function
    		end if
    	end if
      WSHShell.Run "x:\Progra~1\rdeploy\rdeploy.exe"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION RdeployMulticast()
      SET WSHShell = CreateObject("WScript.Shell")
    	 WSHShell.Run "x:\MapDrives71.cmd",,True    
    	set filesys=CreateObject("Scripting.FileSystemObject")
    	If Not filesys.FolderExists("I:\") Then
    		MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
    		Exit Function
    	end if
      WSHShell.Run "I:\Automation\ManualMulticast.hta"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION Notepad()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "notepad.exe"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION FileExplorer()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "X:\Progra~1\filemanager\a43.exe"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION GetDataBack()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "x:\Progra~1\GetDataBack\gdbnt.exe"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION HardDriveTest()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "cmd /c x:\Progra~1\HardDriveTester\bst5.exe"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION CP()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "cmd.exe"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION Reboot()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "shutdown -r -t 00"
    	SET WSHShell = NOTHING
    END FUNCTION
      FUNCTION Shutdown()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "shutdown -s -t 00"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION InjectSysprep71()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "x:\MapDrives71.cmd",,True    
    	Set filesys=CreateObject("Scripting.FileSystemObject")
      If Not filesys.FolderExists("I:\") Then
        MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
        Exit Function
      end if
    	WSHShell.Run "i:\Automation\InjectSysprep.hta"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION NS71InstallWin764()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "x:\MapDrives71.cmd",,True    
    	Set filesys=CreateObject("Scripting.FileSystemObject")
      If Not filesys.FolderExists("I:\") Then
        MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
        Exit Function
      end if
    	WSHShell.Run "i:\Automation\ImageMenu764.hta"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION NS71InstallWin7()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "x:\MapDrives71.cmd",,True    
    	Set filesys=CreateObject("Scripting.FileSystemObject")
      If Not filesys.FolderExists("I:\") Then
        MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
        Exit Function
      end if
    	WSHShell.Run "i:\Automation\ImageMenu7.hta"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION NS71ImageXP()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "x:\MapDrives71.cmd",,True    
    	Set filesys=CreateObject("Scripting.FileSystemObject")
      If Not filesys.FolderExists("I:\") Then
        MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
        Exit Function
      end if
    	WSHShell.Run "i:\Automation\ImageMenu.hta"
      SET WSHShell = NOTHING
    END FUNCTION
    
    FUNCTION NS71InstallWinSvr2008()
      SET WSHShell = CreateObject("WScript.Shell")
      WSHShell.Run "x:\MapDrives71.cmd",,True    
    	Set filesys=CreateObject("Scripting.FileSystemObject")
      If Not filesys.FolderExists("I:\") Then
        MsgBox("Network drive (I:) did not map to \\d204.ipsd.net\express.  Check date/time of this computer and that SMDS2 and your local PXE server are accessable.")
        Exit Function
      end if
    	WSHShell.Run "I:\Automation\ImageMenuS2008.hta"
      SET WSHShell = NOTHING
    END FUNCTION
    
    </SCRIPT>
    <center>
    <FONT COLOR="Black" FACE="Tahoma">
    
    <table width=95% border=0 padding=0 spacing=0>
      <col style="background-color: #6374AB;">
      <col style="background-color: #00AA00;">
      <TR>
        <TD><center><H2>Tools</H2></TD>
        <TD><center><H2><center>Images on <BR>D204\express</H2></TD>
      </TR>
      <TR>
        <TD valign="top"><center>
        <BUTTON ACCESSKEY="C" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="CP()"><U>C</U>ommand Prompt</BUTTON><BR>
        <BUTTON ACCESSKEY="N" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="Notepad()"><U>N</U>otepad</BUTTON><BR>
        <BUTTON ACCESSKEY="H" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="HardDriveTest()"><U>H</U>ard Drive Tester</BUTTON><BR>
        <BUTTON ACCESSKEY="E" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="Wipe()"><U>E</U>rase Hard Drive</BUTTON><BR>
        <BUTTON ACCESSKEY="F" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="FileExplorer()"><U>F</U>ile Explorer</BUTTON><BR>
        <BUTTON ACCESSKEY="B" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="GetDataBack()">Get Data <U>B</U>ack (file recovery)</BUTTON><BR>
        <BUTTON ACCESSKEY="T" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="Reboot()">Reboo<U>t</U></BUTTON><BR>
        <BUTTON ACCESSKEY="S" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="Shutdown()"><U>S</U>hutdown</BUTTON><BR>
        </TD>
        
        <TD><center>
        <BUTTON ACCESSKEY="P" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="NS71ImageXP()">Windows X<U>P</U> Images</BUTTON><BR>
        <BUTTON ACCESSKEY="W" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="NS71InstallWin7()"><U>W</U>indows 7 32bit Images</BUTTON><BR>
        <BUTTON ACCESSKEY="4" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="NS71InstallWin764()">Windows 7 6<U>4</U>bit Images</BUTTON><BR>
        <BUTTON ACCESSKEY="6" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="NS71InstallWinSvr2008()">Windows Svr 200<U>8</U> Images</BUTTON><BR>
        <BUTTON ACCESSKEY="I" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="InjectSysprep71()">In<U>j</U>ect Sysprep from d204\express</BUTTON><BR>
        <BUTTON ACCESSKEY="D" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="RDeploy71()">R<U>D</U>eploy</BUTTON><BR>
        <BUTTON ACCESSKEY="O" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="Ghost71()">Gh<U>o</U>st</BUTTON><BR>
        <BUTTON ACCESSKEY="M" STYLE="font-face:Tahoma;font-size:13px;width: 2.5in;" onclick="RdeployMulticast()">Rdeploy <U>M</U>ulticast</BUTTON><BR>
        </TD>
      </TR>
    </table>
    
    </DIV>
     </BODY>
     </HTML>

    Friday, November 30, 2012 11:38 PM

All replies

  • Hi,

    Thanks for sharing. We really appreciate your time and efforts. Hope your experience will help other community members facing similar problems.


    Leo Huang
    TechNet Community Support

    Monday, December 3, 2012 7:22 AM
    Moderator
  • Good write up. I just wanted to let you know that BDDRUN.exe gets injected when you create a LiteTouch Image with MDT you can get the newest version by installing MDT 2012.

    Sean

    Friday, December 21, 2012 2:40 AM