Tuesday, October 8, 2013

Command Line VHD Merge


Example:

Server: PVS01

Store Folder Name: D:\PVSStore

Image File List:
W7_Image_Clean_V2.5.vhd (Merged Base file)
W7_Image_Clean_V2.6.avhd
W7_Image_Clean_V2.7.avhd
W7_Image_Clean_V2.8.avhd

To create a new merge based including W7_Image_Clean_V2.5.vhd (Merged Base file), W7_Image_Clean_V2.6.avhd, W7_Image_Clean_V2.7.avhd and W7_Image_Clean_V2.8.avhd, issue the following command:

rundll32 VhdUtil.dll,VhdMerge  D:\PVSStore\W7_Image_Clean_V2.8.avhd W7_Image_Clean_V2.5.vhd  D:\PVSStore\W7_Image_Clean_V2_New.vhd > D:\PVSStore\merge_log.txt

The benefit of using command line to do the merging is it can give you a debug log that will be useful for troubleshooting purposes, but please remember that it won't update the DiskVersion entry in the database.

VMware Workstation Services Manual Startup

:: Start the necessary services
psservice start VMAuthdService
psservice start VMUSBArbService
psservice start VMnetDHCP
psservice start "VMware NAT Service"
psservice start VMwareHostd
   
:: Enable network VMWare network adapters
wmic path win32_networkadapter where index=12 call enable
wmic path win32_networkadapter where index=14 call enable
   
:: Start VMWare
start "" /wait "C:\Program Files (x86)\VMware\VMWare Workstation\vmware.exe"
   
:: Stop services
psservice stop VMnetDHCP
psservice stop "VMware NAT Service"
psservice stop VMwareHostd
psservice stop VMAuthdService
psservice stop VMUSBArbService
   
:: Disable our VMWare network adapters
wmic path win32_networkadapter where index=12 call disable
wmic path win32_networkadapter where index=14 call disable

Run 'wmic nic get name, index' and change the value of 'index=' above accordingly.

Save the file as vmware-run.bat or whatever name you prefer.

Go to Windows' Services and set all the services that started with VMWARE* to manual.

Grab the PSTools from http://technet.microsoft.com/en-us/sysinternals/bb897542 as this batch file required it.