Computer Tips and Tricks
Get the latest posts via rss

Monday, 21 June 2010

How to inject LAN drivers into WDS Server BOOT images

We use WDS (Windows Deployment Services) to image large numbers of computers. Lately we have been using a Windows Server 2008 R2 WDS server with a Windows 7 boot image. However several times we have found that newer PCs/Laptops (manufactured after Windows 7) have trouble PXE booting in to the Windows 7 boot image, due to the lack of LAN drivers.
We found that these drivers need to be "injected" in to the boot image (a .WIM file) to enable the PC/Laptop to be imaged using WDS. After several attempts we found the following procedure worked quite well to achieve this.
Before You Start
  • You’ll need a full install of WAIK (Windows Automated Installation Kit,) as it contains the necessary tools to manage WIM files. This can be done on any system, but if you’re running WDS it is best to perform the injection on the WDS server.

Run: WAIKX86.MSI or WAIKX64.MSI depending. If required, WAIK can be downloaded from the Microsoft Download Site.
  • Next locate the LAN drivers you want to add from the out of the box CD or download from the internet. Extract to a “dump” folder.
  • Subject to advice on other sites DO NOT DISABLE WDS OR THE IMAGE YOU ARE GOING TO EDIT. Doing so can cause problems when mounting and unmounting the image.
  • Remember to ALWAYS Backup the Boot Image you are going to edit, before you start.
  • Remember to use quotation marks “” on directory paths with spaces.
Locating the Required Driver
To find the network drivers required for the LAN card that is missing from the WDS boot image, follow these steps on the PC you want to add drivers for:
  • Boot the PC in to WDS. Before you receive the error message that notifies of the missing driver, press SHIFT+F10 to open a command prompt. When the error appears, clear it. Command prompt will load.
  • At the command prompt, type the following command: Notepad.exe x:\Windows\INF\
  • In the file that is displayed, locate the section that identifies the Plug and Play ID (PnPID) of the third-party network adapter. For example, "DIF_SELECTBESTCOMPATDRV - PCI\VEN_10B7&DEV_9200&SUBSYS_010D1028" is the section that identifies the PnPID of the network adapter in the following file:
  • Locate the correct driver for the network adapter that you identified in step 3. Then, copy the driver on to a USB flash drive.
Testing the Driver
Now that you have the driver you need to make sure it will work within the WDS Boot Image.
To manually load and test the network driver and then verify that it is correct, you must follow these steps after booting the PC in to WDS.
You will need the USB flash drive containing the driver plugged in first. Again use Shift-f10 before the error to enter the CMD prompt.
  • At a command prompt, type the following command, and then press ENTER.
    drvload [USB flash drive]\folder\driver.inf
    You must specify the full path and the name of the driver. For example, if Driver.inf is on a CD, and the CD drive is drive D:, type the following command, and then press ENTER:
drvload.exe d:\Folder\Driver.inf  
  • Type: wpeutil InitializeNetwork and then press ENTER. This will enable network services including TCP/IP.
  • To verify network connectivity, type: ipconfig /all and check to make sure the LAN card has an IP Address. If it has, then the correct driver is loaded.
    Note: The ipconfig /all command generates a detailed configuration report for all interfaces that include any remote access adapters.
Now you have a driver that you know works, you need to “inject” it in to the WDS Boot Image. First you must “mount” the image.
This can be done via command line or with a third party tool.
Mount WDS Boot Image - command Line
  • Logon to the WDS Server.
  • Make sure WAIK is installed.
  • Click START – RUN and type wdsmgmt.msc and click OK.
  • Under the name of your WDS Server, Double Click “Boot Images.”
  • Locate the WDS Boot Image you want to edit, then right-click and select Properties.
  • Under ‘General’ make note of the image “File Name.” This should be “[Image File name].wim” depending on which of the images you wish to edit. These are located at [Install Drive]:\RemoteInstall\Boot\x86\Images
  • Load CMD prompt from START menu (Run as Administrator.)
NOTE: DO NOT close this window until all steps have been completed!!!
  • Type in: "C:\Program Files\Windows AIK\Tools\PETools\copype.cmd" x86 c:\windowspe-x86
NOTE: c:\windowspe-x86: This is where the image will be copied (mounted) to for editing.
  • Now in the Command Prompt type in: Imagex /info e:\remoteinstall\boot\x86\images\[Image File name]).wim (This is the boot image you want to inject drivers in to.)
The following information will be displayed:
  • Make note of the “Boot Index Number.” You will need this in the next step.
  • Next type in: Imagex /mountrw e:\remoteinstall\boot\x86\images\[Image File name]).wim 2[The number you have just noted] mount This will mount the image to C:\windowspe-x86\mount\ folder in read/write mode. You can navigate to this folder and browse the contents and make any changes you like.
Mount WDS Boot Image - ImageX GUI Tool
  • Logon to the WDS Server.
  • Make sure WAIK is installed.
  • Download the latest version from here.
  • Create a folder on C Drive. I called it c:\mount. This is the mount point for the Image.
  • Run the tool and select the “mount” tab
  • Fill in the Mount Point and Source boxes. The source is the name and location of the Boot image you want to edit.
  • Click Select – If there is more than one identifier, choose the correct one.
  • Click Mount and Wait for Confirmation box to notify you that the image is mounted.
Inject the LAN Drivers into the WDS Boot Image
In Windows 7/Server 2008 R2 WAIK, the command line has been changed.
  • Load an Administrative Command Prompt
  • Navigate to C:\Program Files\Windows AIK\Tools\x86
The old command is: peimg /inf=[Driver Dump Location]\[FOLDERNAME]\*.inf /image=C:\windowspe-x86\mount or c:\mount
The new command is: dism /image:c:\mount or c:\windowspe-x86\mount /add-driver /driver:"[Driver Dump]\[FOLDERNAME] /recurse
  • c:\mount or c:\windowspe-x86\mount depends on which method you used to mount the image.
  • [Driver Dump] is where you extracted the download drivers too.
  • [FOLDERNAME] being the subfolder containing the INF files for the LAN drivers.
This injects the drivers straight into the mounted image. You can manually specify which driver is to be installed, or just use the wildcard (*) to install all the drivers found in that folder. Repeat this process for all the drivers you want to install.
Unmount Boot Image and Commit Changes
When you are done, in the Administrative Command Prompt type: imagex /unmount [mount point] /commitNOTE: Mount Point is either c:\mount or c:\windowspe-x86\
This will dismount the image and commit the changes you have made. Do NOT forget the /commit statement or you’ll have to do the whole thing all over again.
The Process is now complete and the drivers have been added to the WDS Boot Image. Try to boot the client in to WDS using the F12 PXE Boot from a PC that uses the new drivers.


Anonymous said...

This more helpful for IT folks


Anonymous said...

Tips from my experience...
gimagex.exe must be copied to folder where is the wimgapi.dll
dism.exe is located in "C:\Program Files\Windows AIK\Tools\x86\Servicing"
mount,inject,commit again with the install.wim image too
replace the images in WDS after all and restart services
works with 2003 sp2 too

Unknown said...
This comment has been removed by a blog administrator.
RKGraves said...

Thank you! I appreciate that you would take the time to document this. Very helpful and well done. Thank you!

Post a Comment