How To: Create WDS Discover Image for Windows 8
I usually do all of my windows installs on my network via a WDS (Windows Deployment Services) server, and thus use PXE boot. Recently, however, I have run into a rather unique case that led me to have to create a discover image to find the server to install windows. About a year ago I purchased a Lenovo Thinkpad W520 laptop. This machine is capable of running in both BIOS and UEFI modes, and for Windows 8 I wanted everything to be in 100% UEFI to take advantage of the faster boot etc… I almost instantly noticed that the network card in the W520 does not support PXE boot in UEFI mode. It only supports this functionality in BIOS mode.
So in order to utilize UEFI on my Laptop and still be able to install customized images from my WDS server, I had to create a Discovery image to boot the laptop into setup. This is basically a Windows PE image that is customized to call the WDS server and start the install process. This image can either be burned to a DVD or placed on a USB flash drive. For the purposes of this guide we will be putting this image on a flash drive, and we will be making an x64 PE image, so for those of you with x86, make the appropriate changes to the commands.
I actually got the idea to do this from the Devhawk.net blog, but the instructions are a little different for Windows 8, so I figured I would write a post on how I did it.
So without further ado, let’s get started.
Step 1: Install the Windows ADK
You will need to install the Windows ADK, which you can download HERE
Next, install the Windows ADK, and select the options shown in the screenshot below:
These are the tools we need to build a custom Windows PE image to start the WDS installation.
Step 2: Create Windows PE Image
The Windows ADK includes a command line tool for creating PE images, called the “Deployment and Imaging Tools Environment”. You need to run this as administrator to start the process. Type the following command:
copype.cmd amd64 C:\winpe_x64
This batch file will create a new PE image of the architecture you specify, which in this case is x64. If you want to create an x86 image, replace amd64 with x86.
Step 3: Mount the PE image with DISM
Now you need to update your PE image with some customizations that will make it look for a WDS server when it boots up. To do this we need to first mount the image using DISM. Thankfully the previous command already gave us a mount point to use, so type the following command exactly as it appears.
dism /Mount-WIM /WimFile:C:\winpe_x64\media\sources\boot.wim /Index:1 /MountDir:C:\winpe_x64\mount
Step 4: Add Custom Device Drivers (optional)
This section is only necessary if you have a network card that is not supported by Windows 8 out of the box. If this is the case, here’s the command to add a custom device driver to your discovery image:
dism /image:c:\winpe_x64\mount /add-driver /driver:”PATHTODRIVERDIRECTORY”
Step 5: Add Setup Packages
By default, the PE image does not include the packages for Windows Setup, so we will need to add those manually. For WDS Discovery we need the setup and setup-client packages. To add these, type the following commands:
dism /image:c:\winpe_x64\mount /add-package /packagepath:”C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Setup.cab”
Followed by:
dism /image:c:\winpe_x64\mount /add-package /packagepath:”C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-Setup-Client.cab”
Step 6: Add winpeshl.ini file
At this point, we have all of the appropriate packages in our PE image, now we need to add a file called “winpeshl.ini” which tells the installer to look for your WDS server. So to create this file open notepad and insert the following:
[LaunchApps]
%SYSTEMDRIVE%\sources\setup.exe, "/wds /wdsdiscover /wdsserver:<fully qualified doman name of server>"
NOTE: In order for this to work, you have to specify your WDS server using the /wdsserver switch. Auto discovery usually ends up throwing an error, so add this to guarantee your image will work.
After you have created this INI file, insert it into C:\winpe_x64\mount\Windows\System32\
Step 7: Add lang.ini file
Next you need to add a lang.ini file, otherwise you will get a nasty error about setup not being able to determine the language to use for setup.
The easiest way to do this is to take the lang.ini file from the sources folder on your Windows 8 Image and put it into C:\winpe_x64\mount\sources\
Step 8: Commit and Unmount PE Image
We have made all of the modifications to the PE image that we need to, so now it’s time to commit those changes to our boot.wim and unmount the image. To do this, type the following command:
dism /unmount-wim /mountdir:c:\winpe_x64\mount /commit
Now the contents of the “media” folder is ready to be copied to a USB pen drive.
Step 8: Copy your Image to your Flash Drive
Now that your image is done, you need to copy it to a USB flash drive. First make sure that your drive is formatted in FAT32, this is very important, as an NTFS formatted drive will not boot.
Next, type the following command to copy all of your files onto the flash drive:
xcopy c:\winpe_x64\media\*.* /e f:
Where F: is replaced by the letter assigned to your flash drive.
Step 9: Boot from your USB Flash Drive
Now you are ready to boot your PC from your USB flash drive. Boot it like you normally would from a flash drive, and if you did everything right you will end up at the same WDS screen that you would normally see if you PXE boot your machine. And the best part? If your machine supports UEFI, this boots in UEFI mode. So if your NIC is one of the many that cannot PXE boot in UEFI mode, this will do exactly what you want while still allowing you to install your custom images off your WDS server.
I hope this guide helps some of you, and as usual if you have any questions, leave them in the comments and I will help you with anything you need clarification on.
-
annoyed
-
Pete Long
-
Charlie