WdsClient – An error occurred while obtaining an IP address from the DHCP server.

WdsClient – An error occurred while obtaining an IP address from the DHCP server. Please check to ensure that there is an operation DHCP server on this network segment.

This is the error I got recently when trying to image some new machines for one of the schools I support.

WdsClient - An error occurred while obtaining an IP address

The correct drivers were installed on the WDS server and I’d previously imaged some desktops of the same model with no problems. I tried a new cable and network point, restarted WDS and DHCP on the server all to no avail. All settings on WDS were fine and as they should be.

Do try the above steps first, as 90% of the time it’s resolved by one of them. This problem is also common if you have a faulty or very long network cable.

It turned out that the PC was taking too long to get an IP address, meaning it couldn’t reach the WDS server at the time it tried to. By the time it has been assigned an IP it had already timed out and thrown me this error.

DHCP seemed to be functioning correctly, as other devices were working with no problems – it just seemed to be DHCP and WDS that weren’t working together properly. I needed a way around this, and after a lot of research I found a way to modify my WIM file so it wouldn’t launch the PE until it could ping the server. Obviously if it can ping it has an IP address, so therefore can continue as it should.

Here’s how to do it:

I advise doing this on a client PC, and not the server.

  1. Install the Windows AIK. In this example, I am using and deploying Windows 7, so required the Windows 7 AIK.
  2. Open “Windows PE Tools Command Prompt” and type the command below that corresponds to the CPU architecture that your current WDS boot image is on:
    • 32bit - copype x86 C:\newbootimage
    • 64bit – copype x64 C:\newbootimage

      These commands will create a new Windows PE wim image in C:\newbootimage. The file path can be altered if you so wish.

  3. Go into the WDS console on your server, and export the current image that you’re having trouble booting to. (Right click > Export Image) and copy that to C:\oldbootimage on the client PC you created other wim with in the previous step. For the rest of the tutorial, I will assume this file is called wds.wim
  4. Mount both images:
    • Mount the image created in step two by running:
       imagex /mountrw “C:\newbootimage\WinPE.wim” 1 "C:\newbootimage\mount"
    • Mount the image exported in step three by running:
       imagex /mountrw “C:\oldbootimage\wds.wim” 2 "C:\oldbootimage\mount"
  5. Now, copy the sources folder from the old boot image (C:\oldbootimage\mount\sources) to the new boot image (C:\newbootimage\mount\sources). This adds the necessary WDS client setup files to the new image.
  6. Open the startnet.cmd file (C:\newbootimage\mount\windows\system32\starnet.cmd) in Notepad.
    The current files will most likely contain very little text. You need to replace the contents with the following:

    @echo off
     wpeinit
     
     @echo Waiting for the WDS server…
     :testagain
     ping –n 1 wds > NUL
     if %errorlevel% == 0 goto pingok
     
     REM wait 3 sec. and try it again
     ping –n 3 127.0.0.1 >nul
     goto testagain
     
     :pingok
     x:\sources\setup.exe /wds /wdsserver:WDS
     

    This small script will keep trying to ping the server called WDS until it receives at reply. At which point it will continue to boot into WDS setup mode.
    You may change the server name from WDS in the script if you wish, however I advise keeping the script as is and adding a DNS entry for the WDS to point to your server’s IP. This way, the wim file is usable across any server / network by just adding a DNS entry.

  7. Save changes to the cmd file.
  8. Remove all unnecessary components from the new WDS image with the following command:
     peimg /prep mount\windows
  9. Unmount the new image and save changes with the following command:
     imagex /unmount /commit mount
  10. At this point the new wim image will probably be around 200mb. It’s advised you export the image to a new wim file to reduce it in size with the following command:
     imagex /export “C:\newbootimage\WinPE.wim” 1 “C:\newbootimage\newwds.wim” “Custom WDS Windows PE”

The image at this point is now complete, and will be around 120mb. You can then add this to the boot images section of your WDS server as you normally would with boot.wim from a Windows DVD or ISO.

 

For your convenience, I have created a Windows 7 32 and 64 bit version of wim which you can download from the following links:

Thanks to svengru at TechNet for sharing his solution. The above is merely a modified version of his solution, clearing up some sections that don’t need to be done post Vista such as importing drivers to the wim.

1 comment on WdsClient – An error occurred while obtaining an IP address from the DHCP server.

  1. This issue has been driving me nuts, but not getting it consistently. You’ve saved me hours more headache – THANK YOU!

    I like that I could probably put other scripts in there too. I can’t think what yet, but it could be helpful

Leave a Reply