PXE Booting into MS Windows 7 setup


  • Moderator

    Part 1 Prerequisites

    This tutoral will show you how to pxe boot a target computer into the windows 7 setup program. While I see little value in this since there are other methods to go about installing Windows 7, this question gets asked now and again in the FOG forums. Just recently I had the opportunity to sit down and outline a process for doing this task.

    The traditional method of just loading the iso image on the FOG server and sending it via PXE is not possible since the WIndows 7 dvd is over 3GB in size. Attempting the pxe boot just the boot.wim also fails since the winpe environment that is shipped on the DVD looks for the CDROM drive to load its setup. To work around this issue I ended up building my own WinPE boot image that was able to boot over PXE and then connect to a network share which held the Windows 7 DVD files. All hardware specific network and disk drivers are loaded into the custom WinPE environment, understand that these drivers will not be copied to your target computer, you will need to provide the proper network drivers to your target OS once its installed too.

    To build this custom WinPE boot image you will need the following.

    1. Windows 7 WAIK https://www.microsoft.com/en-us/download/details.aspx?id=5753
    2. Not necessary but a good idea Windows 7SP1 WAIK https://www.microsoft.com/en-us/download/details.aspx?id=5188
    3. The WinPE 3.0 Driver CAB from Dell (reported to work with some other manufacturers) http://downloads.dell.com/FOLDER03652574M/1/WINPE3.0-DRIVERS-A20-CT5DP.CAB
    4. A fresh Pepsi cola and about 15 minutes of time.

    Now you need to architecture of WinPE 3.0 you will build. Its important to point out in the beginning so you don’t get to the end and get surprised. WinPE x86 can install both x86 and x64 bit versions of the OS. WinPE x64 can only install x64 bit versions of the OS. So if you know you will only deploy x64 bit OS then go ahead and build a WinPE x64 image, otherwise you might want to play it safe and go with WinPE x86. They are functionally equivalent and there is no difference in the creation or the execution. You just need to pick one and work with it. I’ll give you directions to both so you can make both if you want.

    The last bit of house keeping is to give some background links on where we are going here.

    Source of the request to build a solution to PXE boot into windows setup.
    https://forums.fogproject.org/topic/7751/fog-pxe-ipxe-boot-win-7-wimboot-cd-dvd-missing-issue
    http://www.tecmint.com/installing-windows-7-over-pxe-network-boot-in-centos

    Tutorial I wrote on PXE booting into the MDT lite touch setup
    https://forums.fogproject.org/topic/6284/booting-mdt-2013-litetouch-with-fog

    The first thing that needs to be done is setup your winpe build out environment

    1. Install WAIK and the WAIK supplement programs.
    2. Extract the Dell CAB file to c:\winpe (Hint: If you open the CAB with 7-Zip you can just drag the winpe folder from the cab and drop it on the root of C:. If you need additional drivers not supplied by the Dell cab then download the proper WinPE 3.0 driver cab for your hardware and merge it into the winpe folder structure.
    3. Now from the start menu launch the WAIK command line tool {insert actual path to tool here} with the “Run as Administrator” option.
    4. On a Windows server/Workstation create a network share. Set the permissions appropriate for you environment. The WinPE environment that we are building needs read only access to this network share based on the user ID we’ll provide in our script.
    5. Copy the entire contents of the WIndows 7 DVD to this network share
    6. Take a sip of your cola now we’re about to get busy
    7. Continue to Part 2 for x86 or Part 3 for x64 WinPE environments.

  • Moderator

    Part 2 Building a WinPE x86 boot image

    The steps are pretty quick. You can either just copy and paste them, or if you build a custom WinPE environment often create a batch file so you can just launch the batch file and come back a few minutes later and its done.

    Just a reminder again, you need to launch the WAIK command line tool with “Run as Administrator” to get the necessary rights to mount the wim.

    # Setup your WinPE x86 Environment
    copype x86 C:\winPE_x86
    copy "C:\Program Files\Windows AIK\Tools\PETools\x86\winpe.wim" C:\winpe_x86\ISO\Sources\Boot.wim
    copy "C:\Program Files\Windows AIK\Tools\x86\Imagex.exe" C:\winpe_x86\ISO\
    
    # Create a directory to hang your boot.wim on and then hang it
    mkdir c:\img
    imagex /mountrw C:\winPE_x86\ISO\sources\boot.wim  1 c:\img
    
    # Inject the x86 drivers from the extracted Dell cab file
    DISM /Image:c:\img /Add-Driver /Driver:c:\winpe\x86 /Recurse /ForceUnsigned
    
    ####################################
    Using notepad edit C:\img\windows\system32\startnet.cmd
    
      @echo off
      echo Setting up WinPE
      wpeinit
    
      echo Connecting to the remote share
      net use z: \\<server_name>\<share_name> /user:<domain\uid> <pass>
      z:
      setup.exe
    ####################################
    
    # This tip was submitted by KnightRaven, if you remove this file booting the iso image won't prompt
    # you to press enter to boot from the CD
    del  C:\winPE_x86\ISO\boot\bootfix.bin
    
    # This command unmounts the wim. If you want the wim alone its this directory C:\winPE_x86\ISO\sources\boot.wim  
    DISM /Unmount-WIM /MountDir:c:\img /commit
    
    # This will covert the wim into a bootable iso image. 
    oscdimg -n -bC:\winpe_x86\etfsboot.com C:\winpe_x86\ISO C:\winpe_x86\winpe_x86.iso
    

    For the net use command net use z: \\<server_name>\<share_name> /user:<domain\uid> <pass> replace the bracketed fields with the server name and share you created in Part 1. For the uid and pass enter the proper domain (or workstation) account required to access that share.

    That is it for the WinPE x86 build out. Proceed to Part 4


  • Moderator

    Part 3 Building a WinPE x64 boot image

    The steps are pretty quick (same as part 2).

    You can either just copy and paste them, or if you build a custom WinPE environment often create a batch file so you can just launch the batch file and come back a few minutes later and its done.

    Just a reminder again, you need to launch the WAIK command line tool with “Run as Administrator” to get the necessary rights to mount the wim.

    # Setup your WinPE amd64 Environment
    copype x86 C:\winPE_amd64
    copy "C:\Program Files\Windows AIK\Tools\PETools\amd64\winpe.wim" C:\winpe_amd64\ISO\Sources\Boot.wim
    copy "C:\Program Files\Windows AIK\Tools\amd64\Imagex.exe" C:\winpe_amd64\ISO\
    
    # Create a directory to hang your boot.wim on and then hang it
    mkdir c:\img
    imagex /mountrw C:\winPE_amd64\ISO\sources\boot.wim  1 c:\img
    
    # Inject the x64 drivers from the extracted Dell cab file
    DISM /Image:c:\img /Add-Driver /Driver:c:\winpe\x64 /Recurse /ForceUnsigned
    
    ####################################
    Using notepad edit C:\img\windows\system32\startnet.cmd
    
      @echo off
      echo Setting up WinPE
      wpeinit
    
      echo Connecting to the remote share
      net use z: \\<server_name>\<share_name> /user:<domain\uid> <pass>
      z:
      setup.exe
    ####################################
    
    # This tip was submitted by KnightRaven, if you remove this file booting the iso image won't prompt
    # you to press enter to boot from the CD
    del  C:\winPE_amd64\ISO\boot\bootfix.bin
    
    
    # This command unmounts the wim. If you want the wim alone its this directory C:\winPE_amd64\ISO\sources\boot.wim  
    DISM /Unmount-WIM /MountDir:c:\img /commit
    
    # This will covert the wim into a bootable iso image. 
    oscdimg -n -bC:\winpe_amd64\etfsboot.com C:\winpe_amd64\ISO C:\winpe_amd64\winpe_amd64.iso
    

    For the net use command net use z: \\<server_name>\<share_name> /user:<domain\uid> <pass> replace the bracketed fields with the server name and share you created in Part 1. For the uid and pass enter the proper domain (or workstation) account required to access that share.

    That is it for the WinPE x64 build out. Proceed to Part 4


  • Moderator

    Part 4 Configuring FOG

    Before we get to setting up fog I want to give you one warning. Every time you mount and unmount that boot.wim file, we found that the file grows by a certain percentage. Even if you change nothing. The key/goal is to keep that boot.wim file as small as possible. A small boot.wim file means that the file will transfer faster to the target computer, boot faster, and require less RAM to hold the virtual drive. The point is if you need to open the boot.wim to add additional drivers, you are better off just recreating it from the original winpe.wim file, run through the script and before you unmount it add your custom drivers (or automate the custom driver install with DISM as we are doing with the Dell CAB).

    Now setting up FOG

    1. On your fog server create the following directory with this command
      md /var/www/html/fog/iso
    2. Copy one or both of the ISOs you created in Part 2 and/or Part 3 to that directory (use putty, tftp, or ftp to get the iso files onto the FOG server, then move them to the iso directory)
    3. Make sure the ISOs mode are World:Read
    4. Log into the FOG Management GUI
    5. Go Settings->
    6. Fill in the following details for the WinPE x86:
      Menu Item: Win7Setup.x86
      Description: Windows 7 DVD x86 Boot
      Parameters:
      initrd initrd http://<ip_addr_fog_server>/fog/iso/winpe_x86.iso
      chain memdisk iso raw
      Menu show with: All Hosts
    7. Fill in the following details for the WinPE x64:
      Menu Item: Win7Setup.x64
      Description: Windows 7 DVD x64 Boot
      Parameters:
      initrd initrd http://<ip_addr_fog_server>/fog/iso/winpe_amd64.iso
      chain memdisk iso raw
      Menu show with: All Hosts

    From a practical standpoint if you wanted to host 4 different version of windows for installation you could do it with one winPE environment with some way to select which share you connect to. Or create 4 different boot ISOs (one for each OS). While I haven’t tried this, the WinPE 3.0 boot image we created here should launch the setup installers for any OS greater or equal to Windows 7.


Log in to reply
 

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.