Ok, so WDS is a wonderful thing... when it works. And to be honest 80% of the effort using WDS is the setup. Particularly if you want to use Static IP addressing and not run it from DHCP. In an environment that uses static addressing to promote high-availability and the subnet-bound nature of DHCP means that a static IP setup offers an alternative option.
Others have noted that the static IP method is limited in that boot images have to be dedicated to particular IP address, however if you're in the position of imaging a box and then re-addressing it to it's final network, then it's not too bad.
The summary steps of setting up a Static IP based WDS Discovery Boot image are as follows:
- Create a discovery image based upon your regular (or even standard Windows 2008) boot image. This is best done via the WDS MMC snap-in.
- Ensure your image has all the necessary drivers. Again, through the WDS MMC snap-in, add the driver packages to WDS and then add those packages to the boot image.
- Customise the boot image. There's a fair bit of detail in this and that's the focus of this post.
- Create the boot ISO image using the Windows Automated Installation Kit (WAIK).
- Either burn the image to physical media, or make it available to boot from if you're running a VM environment.
Sound simple? Ok, so let's get into the details of the image customisation...
Assuming you've installed WAIK, setup a new winpe file structure. Do this from a "Deployment Tools Command Prompt", run:
copype amd64 c:\winpe
where amd64 is the architecture of your boot image (amd64 in my case) and;
c:\winpe is the root folder of your new winpe folder structure. This folder will be home to the ISO image and the mount point for your image.
From an administrative command prompt run:
imagex /mountrw c:\winpe\ISO\boot.wim 1 c:\winpe\mount
notepad "c:\winpe\mount\windows\system32\start_static_net.cmd"
Edit the content to read:
wpeutil.exe InitializeNetwork
netsh interface ipv4 set address "Local Area Connection" static [static_ip] [netmask] [gateway_ip]
net start "dns client"
ping -n 5 [gateway_ip]
netsh interface ipv4 set dns "Local Area Connection" static [dnsserver_ip] primary validate=no
%SYSTEMDRIVE%\sources\setup.exe /wdsdiscover /WdsServer:[wds_server_fqdn]
Save and close the file.
From the same command prompt, run:
notepad "c:\winpe\mount\windows\system32\winpeshl.ini"
Edit the content to read:
[LaunchApps]
%SYSTEMDRIVE%\windows\system32\start_static_net.cmd
Save and close the file.
Now close any applications that may reference the mount folder or its files.
Next we unmount the image and commit the changes:
imagex /unmount c:\winpe\mount /commit
To build the ISO, open a WAIK "Deployment Tools Command Prompt" and run:
oscdimg -n -bc:\winpe\ISO\boot\etfsboot.com c:\winpe\ISO c:\[iso_filename].iso
Voila! You should now have a bootable WDS discovery image with a static IP to work with.
Now for a bit of explanation about the .cmd script;
- the call to wpeutil starts the windows networking an enumerates the available drivers.
- the first netsh call sets the static ip addres, no surprises there.
- the call to net start gets the dns module going, but it will take a moment to initialise, hence the following call to ping.
- the second call to netsh sets the static DNS address that will be used to lookup the WDS server name. It's important that if your DNS is not at the same level as the WinPE image (e.g. Windows 2003), then the validate=no option will allow the static DNS entry to be set without validation (which is the default).
Well I hope that helps you in your quest for WDS glory!