vivion32 发表于 2018-6-7 08:08:43

Injecting VMware drivers into your Windows 7/2008R2 Install Discs

  I like to perform unattended installations of my operating systems, likeWindows Server 2008 R2 or Windows 7 using autounattend.xml so thatrequires that the image have the required drivers to recognize criticaldevices like mass storage hardware. One of the performance optimizationsthat I always include in our Windows VM templates is the VMwareparavirtual SCSI driver. This is a high performance mass storage driverthat is optimized for virtual environments and gives you the best diskI/O performance. Unfortunately Microsoft does not include it out of thebox on any OS install disk.

So you have two options:

1) Extract boot floppies from an ESXi update. I posted a blogon this a while back. Then you need to mount the virtual floppy imageduring the Windows install process and manually load the driver. Thisdoes not work for an unattended installation as Windows doesn'tautomatically look for mass storage drivers.

2) Inject the mass storage drivers directly into the boot.wim file,so it is 'baked in' and then you can use an automated Windows installprocess all while using the high performance SCSI driver. I also injectthe drivers into the main OS image (install.wim) so they are availableto the operating system after installation.

Since option #2 is more automated, that is of course the option that Iwant to use. It's a bit of a complicated process, but in the end inmakes life easier. This process can work for other drivers as well, ifyou also want to use the ISO image on a physical server that has aunique mass storage controller, for instance.

Here is the basic process:

1) You will need to download and install the Windows Automated Installation Kit(WAIK). I used the latest version for Windows 7. Best practices is toinstall it on a x64 computer, so you can manipulate x64 images shouldyou need to do that.

2) Perform a fully default installation of the WAIK. After theinstallation is complete, launch the Deployment Tools command prompt.

3) Mount the ISO image of your operating system. Navigate to the Sources directory and copy boot.wim to your computer, say on the D:\ drive.

4) Create a folder on your D:\ drive called Drivers.VMware provides both 32-bit and 64-bit pvscsi drivers, and you must usethe right one depending on what CPU architecture you are injecting thedrivers into. The easiest solution is to leverage an existing 32-bit or64-bit VM running on vSphere and go into the C:\Program Files\VMware\VMware Tools\Drivers\pvscsi and copy the files in there to D:\drivers.

To verify the supported architecture of the drivers, open the pvscsi.inffile and scroll down to the section. If you see NTamd64,you have 64-bit drivers. If you see NTx86, you have 32-bit drivers. The64-bit pvscsi.sys file is also larger than the 32-bit version (40K vs35K for vSphere 4.1).

Do not inject both drivers into your image; only use the matching driverfor the OS you are modifying. Server 2008 R2 is 64-bit only, whereasyou have a choice with Windows 7.

5) Create a folder on the D:\ drive called Mount.

6) In the deployment tool command prompt type:

dism /get-wiminfo /wimfile:d:\boot.wim

And look at the index numbers. This is key!You must select index 2,the Windows setup image. If you inject the drivers into index 1, theWindows setup routine will NOT see them and you will be banging yourhead against the wall.

  
7) In the deployment tool command prompt type:

dism /Mount-Wim /WimFile:D:\boot.wim /Index:2 /MountDir:D:\mount

8) You should see an operation successful if the image mounted properly.

9) In the deployment tool command prompt type:

dism /image:D:\mount /Add-Driver /driver:d:\drivers\pvscsi.inf

10) You should see an operation successful if the driver was injected properly.

11) Commit the changes and unmount the image with this command:

dism /unmount-wim /mountdir:d:\mount /commit

12) At this point I also inject the same drivers into thesources\install.wim file, so the drivers are present before VMware toolsgets installed. You follow the same procedure of mounting the WIM,adding the drivers, and then committing the changes. Most install.wimfiles have multiple images in them, so execute step #6 to list all ofthe images in the WIM and select the right one(s) to inject the driversinto.

13) Create a backup of your OS ISO file, and then use your favorite ISO editing tool (such as UltraISO) and replace the boot.wim and install.wim files in the Sources directory.

Now you can use the new ISO image to create a VM which uses the pvscsicontroller for the boot drive, and you won't need to manually mount avirtual floppy drive to use a pvscsi boot disk.

If you also want to inject the VMware vmxnet3 drivers, you can use thesame procedures. But where do you find the drivers? On a VM running onvSphere navigate to C:\Program Files\VMware\VMware Tools\Drivers\vmxnet3. Copy all of the driver files to the same driver folder from above, and run step #9 a second time, but specifying the vmxnet3ndis6.inf file. Unlike the pvscsi driver, the VMXNET3 driver supports both 32-bit and 64-bit versions with the same set of files.

I would not recommend including the VMware mouse driver (vmmouse.inf) asit's an unsigned driver and you will get an “Error 50 The request isnot supported” when you try and commit the image changes, unless you usethe /forceunsigned switch when adding the driver. VMware tools will ofcourse install the mouse driver, so just leave this driver out.

Update: I wrote a blog about incorporating thesedrivers into the Windows Recovery environment. This can be very usefulif a server goes belly up and you want to try and repair it. You cancheck that out here.
页: [1]
查看完整版本: Injecting VMware drivers into your Windows 7/2008R2 Install Discs