Friday, November 17, 2023

Manually Adding VMware Tools Drivers into a Offline Windows Installation

Background

This is an option that would come in handy when you are in a situation, where you are unable to load a Windows VM in VMware due to the lack of drivers. I ran into a similar situation with a Windows box that was converted from Physical to Virtual without enabling VMware Tools installation on the destination, during conversation. This resulted with the converted Windows box on VMware booting up to the Windows Splash screen and then resulting with a black screen. The boot log indicated that Windows could not load the Display driver.

Preparation

Turn down the VM and copy the VMDK that contains the Operating System to a separate temporary folder. Spin up a new Windows VM or you could use an existing VM for this purpose. Attach the copied VMDK as an existing hard drive to the new VM and load into Windows.

I used a fresh temporary VM (without VMware Tools installed) for this purpose, so it allowed me to directly attached the VMware Tools ISO into the VM from the vCenter Console. You could chose the best option that suites you to get the VMware Tools install sources loaded up into your VM.

In my case, I'm after the VMware Display driver. In your case, you could go after the driver you intend to, and the process will still be the same, except for the driver I chose to copy from.

Extract the VMware drivers to a local folder, which should look like below, after extraction. To extract the drivers, follow this guide from VMware, Extracting the drivers from VMware Tools bundled with VMware Workstation (2032184)

The drivers you seek will be in the directory [extracted_folder]\VMware\VMware Tools\VMware\Drivers.



Since I'm after the display driver, I copied the video_wddm folder into a folder I created under C:\vmdrivers\.



Make sure the VMDK containing the Operating System of the problematic VM is successfully mounted within this environment. In my case, it would be the F:\ drive as shown.






Using DISM to Inject Drivers into an Offline Windows Installation

You would need to first identify the following information.

  • Image: In my case, this would be the VMDK attached to this environment as an existing disk. Value for the command would be F:.

  • Driver: This will be the driver you want to inject into the image. You need to point DISM towards the INF file in the driver directory. DISM will then inflate the driver as needed using the applicable components within the folder. In my case, this would be C:\vmdrivers\video_wddm\Vista\vm3d.inf.

Accordingly, the command to be executed would be as below. Make sure this is executed using an elevated command prompt.

 DISM /Image:F: /Add-Driver /Driver:C:\vmdrivers\video_wddm\Vista\vm3d.inf 

Verify the driver got successfully injected into the image, by running the below command. All drivers loaded within the image will be listed. To make my life easy, I piped the output to a text file and did a search for VMware.

 DISM /Image:F: /Get-Drivers 

 

Documentation on the further use of DISM and Drivers can be found in this Microsoft Article Add and Remove Driver packages to an offline Windows Image.

Finally I shutdown the VM and re-attached the VMDK to it's original VM and booted it up with the successful loading of the display driver.

No comments:

Post a Comment