Chris123NT's Blog

Where I rant and rave about all things tech

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 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\”

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\”


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:


%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.

Tags: , , , , , , ,

  • annoyed

    your guide does not work!
    I get to add setup packages and dism doesn’t recognize the command line option “FILES”!!!!!!!!!!! epic fail

    • Erick Decker

      It works if you manually type the commands. Don’t copy and paste them!

    • manners_matter

      Not a nice way to ask for help.

    • Angelo

      The quotations used in this webpage are not ” so Windows doesn’t recognize them.

  • Pete Long

    You can just use WDS to do this.

    • CH0ZMAN

      what about 32bit? (dell Latitude 10 st2)

      • CH0ZMAN

        w/docking station…..

  • Charlie

    Annoyed: I don’t know why it doesn’t like the path even when you add quotes, but the way to get around this is to CD to the directory where the needed .cab files are, then you only need to use this: / and /

  • Dave

    In the ten minutes it took me to follow these instructions, you solved months of frustration. Thanks to this we are finally able to image the Dell Latitude 10 tablets the medical staff wanted. We are in the process of modifying the WIM to pre-load our base software.

    Thank you for your work. Great instructions.

    • Dana

      How did you get it to boot on the tablet? I’ve tried docked and undocked with no luck – it won’t recognize the network connection. Error: WdsClient: An error occured while obtaining an IP address from the DHCP server. Please check to ensure that there is an operational DHCP server on this network segment.

  • Ryan

    Hello I am following these instructions for Windows 8.1. I’ve downloaded the 8.1 ADK and all these steps work fine, but when I attempt to boot to the discover image I get the message that the command “/wds /wdsdiscover /wdsserver:” does not exist. I am wondering if anyone has any suggestions.

    • Jeff

      Same problem here.

    • Harish

      Same error here..

    • Allan

      Solved this by editing the winpeshl.ini file to not have the comma and quotation marks.

      %SYSTEMDRIVE%sourcessetup.exe /wds /wdsdiscover /wdsserver:

  • Цветелин Павлов

    The image, produced by the WDS on Server 2012 R2 have errors (when you try to run them on UEFI based computer).

    winpesh.ini content must be:


    %SYSTEMDRIVE%sourcessetup.exe, /wds /wdsdiscover /wdsserver:

    … without the outermost quotes, or the setup will throw error at startup. Since it is with quotes in this article, I wanted to emphasis this…

  • Chris

    This post is great, with a little change to the winpeshl.ini to work with Windows 8.1 it solved months of fustration, thanks!

  • garegin

    the guide for discover images on TechNet has had errors for years and its unfixed. I would get an error message during bootup. Luckily I stumbled upon a CBT Nugget video where the speaker mentioned that he had the same problem.

  • Nick Voss

    I’ve had success creating the bootable USB. However when I apply an image I get “Windows could not apply unattend settings during pass [offlineServicing]”. My unattend file from the sysprepped image has nothing in the unattend section. If I apply the image using the main WDS boot images and PXE boot I don’t get this from the image. I can also install this WIM to the machine manually with winpe with success. I’m not sure where to even start honestly. Do you have any thoughts?

  • John Wilt

    This is great for deploying an image to a machine without a NIC, how about for capturing?

  • Gordon Myers

    I can’t seem to get past Step 5: Whenever I try to add the file using the add-package flag it says Error 0x800f081e: The specified package is not applicable to this image. I have tried both architectures but it’s always the same.

  • Tom

    It doesn’t work… “Boot failure. Try other boot resources….” Is there anyone who can provide a COMPLETE list of things which has to be done to finally have it sorted? All elements went properly but it doesn’t boot.

October 2012
« Sep   Nov »