Tuesday, November 13, 2018

Injecting Drivers into .WIM Files

When you purchase new machines to use with Windows Deployment Services, you may need to update your WIM OS Installation Images and Boot Images to include drivers that may be missing.  I am blogging to so that I don't forget the commands again!

In this example, I have a new Dell Optiplex 7060.  I have already injected all of the drivers into my Windows 10 .WIM image file, but now I'm trying to PXE boot a new machine to image.

In this case, the PXE boot works fine, and I get an IP however once the Boom.WIM loads the connection to the server fails.  This is most likely because the Boot.WIM file (which is just a light version of Windows), doesn't have the NIC driver for whatever came in my Optiplex 7060.  So I just need to mount the boot.WIM file, and inject the driver, then save it, and add it back as a new boot option to WDS.

1. Mount the boot.wim file (in my case it is called BootWin10.wim:

The parts highlighted in blue will need to be updated for your environment and file/folder names.

Command:

DISM /Mount-Wim /WimFile:"E:\Operating Systems\Wim Images\Windows 10\BootWin10\BootWin10.wim" /Index:1 /MountDir:"E:\Operating Systems\Mount_Folder\Mount\BootWin10"

You should get a result like this if all went well:



2. Run a DISM script to inject the drivers.  (You will need to already have them extracted and have the path's to their folders jotted down.

Command:

DISM /Image:"E:\Operating Systems\Mount_Folder\Mount\BootWin10" /Add-Driver /Driver:"E:\Operating Systems\Drivers\Windows 10" /recurse

Note:  Because I took the time to extract all of the drivers for my Dell Optiplex 7050's and 7060's I'm just gonna go ahead and add them all to the boot image.  This is definitely overkilling it, but in the end, probably won't make a difference.  I should also mention that in previous jobs where I've used WDS images, we successfully added all of the drivers, of all of our machine types (given that they were all

Just for your own info, in theory, you really should only need to inject the NIC drivers to ensure that the boot.WIM image can talk to the WDS server.


So your prompt's output should look like this add the drivers get added:


At the very end, the last line should read "The operation completed successfully." and then you should be good to go.  If some drivers did fail to "inject" properly, I would just check which ones they are, and if they don't relate to the NIC you can probably ignore it.

3.  Commit changes and Save new WIM file. 

Now that you've added your drivers, you just need to unmount and save the changes to your new boot.wim file.

Command:

DISM /Unmount-Wim /MountDir:"E:\Operating Systems\Mount_Folder\Mount\BootWin10" /Commit

Should get a screen similar to this:


Note: The error message at the bottom that (Error 0xc1420117)

The directory could not be completely unmounted.  This is usually due to applications that still have files opened within the mount directory.  Close these files and unmount again to complete the unmount process.

In 99.9% of the cases, where I have seen this error come up, there is nothing wrong and it can be ignored as the WIM saved properly.

To verify if the WIM file unmounted properly, go check the directory where you mounted it.  If the directory is now empty, it most likely unmounted without any issue.  You can also just run the unmount command one more time, and if you see this message likely everything is fine:



4. To finish up we just need to add the updated boot.wim file to WDS and do a test boot.  Go back to the WDS console, select the Boot Images folder from the left-hand side, and in the Boot Images pane, right click and select Add Boot Image...


Navigate to the folder where you stored the boot.wim file, and select it:


Note: that to make sure you have the right file, look at the Date Modified column next to the file name, and the date and time should be today's date, and the time should be just recently.


Now just follow the wizard, and name your boot file how you'd like it to appear in the boot menu.  I usually name it something distinct to test with. 






No comments:

Post a Comment