다음을 통해 공유


Windows: Installing VMware Tools During Install by modifying Windows Iso

If you routinely deploy new Windows virtual machines then normally you'll have to manually install VMware Tools after the installation is complete. This is fine for those who only deploy a few machines but what of those who are performing mass deployments and you have to rely on the users to perform the install? A good example of this is the technology departments of a school where installing the operating system is part of their labs so you have to rely on them to perform the install. The following is a method to modify your Windows iso images so VMware tools silently installs when Windows is finalizing the installation.

  1.  For windows operating systems mount the “[] /vmimages/tools-isoimages/windows.iso” to the DVD drive of the virtual machine you’ll use to perform the editing.

    Note: Make sure the hard drive has a substantial amount of free space.

  2.  Copy the contents of the windows.iso to a folder. I named mine VMWareTemp and is what I’ll refer to it as in later steps.

  3.  Download the iso for the windows operating system you want to modify.

    Note: Your choice how you get it but I’d recommend installing the vmware desktop client in the virtual machine and downloading it from the datastore since at some point you’ll have to upload it to the datastore.

  4. Install 7zip or some other extractor and extract the contents to a folder

  5. Download and install the latest Windows ADK

  6.  Open Deployment and Imaging Tools Environment with Run as Administrator

  7. To initiate the deployment environment run DandISetEnv.bat

  8. Run:

    Dism /Get-ImageInfo /ImageFile:"<wim file path>"
    

    That will show you the names of the installation choices. Client installations tend to only have one while servers tend to have 4.

    Dism /Mount-Image /ImageFile: <Path to install.wim file in the folder just extracted to should be folder\sources\install.wim> /Name:” <Name of the installation choice> ” /MountDir: <Path of an empty folder you can mount to like a folder called mountdir in the root of the C drive> /CheckIntegrity 
    
  9. If you navigate to the mountdir you’ll see the contents of the operating system in the install.wim.

  10.  In the mountdir navigate to Windows\Setup and in Setup create a folder called Scripts

  11.  Copy the VMWareTemp folder to the root of the mountdir so it’ll end up in the root of the operating systems C:

  12.  Create and save a file called “ SetupComplete.cmd” and have it include the following lines:

    C:\VMWareTemp\setup64.exe /S /v "/qn REBOOT=R ADDLOCAL=ALL"

    rmdir C:\VMWareTemp /s /q

    rmdir C:\Windows\Setup\Scripts /s /q

    Note: Setup64.exe for 64-bit operating systems and setup.exe for 32-bit. Also, the file must be named SetupComplete.cmd windows is only looking for that name it will ignore it if it is named anything else. You can add the switch REMOVE after ADDLOCAL if their is a particular driver you don't want to install. For example, a common driver not to include is "Hgfs" which deals with sharing between the host and virtual machine which some consider a security vulnerability since if the host was compromised it would allow the attacker to use the host to inject into the virtual machine though if your host has been compromised you have bigger problems than a potential injection.

  13.  Copy the file and navigate to <mountdir>\Windows\Setup\Scripts and paste the SetupComplete.cmd file into the Scripts folder.

  14. Now that all the files have been added time to unmount the image.

    dism /unmount-image /mountdir: <Path to mountdir> /commit /CheckIntegrity

  15. If you’re modifying a server iso repeat steps 8-14 for the other three server install options so they will all work.

  16. Download and install ImgBurn. The remaining instructions are pretty much just copied from: http://www.intowindows.com/how-to-add-files-to-bootable-iso-in-windows/

  17.  Launch ImgBurn, click Create image file from files/folders option.

  18.  Switch to the Advanced tab. Click on the Bootable Disc tab that appears when you click on the Advanced tab.

  19.  Next, click on the small browse icon that appears next to the Source box and browse to the new folder containing the contents of your extracted ISO file plus the newly added files.

    Once done, select a location to save the bootable ISO file that you’re going to build in a couple of minutes. To do so, simply click the browse icon next to the Destination box and then browse to the location where you want to save the ISO and then enter a name for the new ISO file.

  20.  Under Bootable Disc tab, select the option labelled Make Image Bootable , select Emulation type as None (Custom) , and then type 8 in the box next to Sectors To Load . If in case, you’re working on Vista ISO, please enter 4.

  21.  Finally, click the small browse icon that appears next to Boot Image box and browse to the Boot folder located in the newly created folder where you have saved extracted ISO file contents. Select the file labelled etfsboot.com file and then click Open button.

  22.  Click Build button to start the process of building your bootable ISO image file. Click Yes or OK when you see the following three dialog boxes to continue building the ISO file.

  23.  For some reason it creates two iso files one just a few kilobytes and one that is the proper size upload the one that’s the proper size.

  24.  Mount it to a virtual machine and perform the install of each option until confirm they all work and if so you’re done.