It’s easier to use PowerShell to mount a VHD than to use the Windows Management Instrumentation (WMI) interface that I used in “ Q. How can I mount a Virtual Hard Disk (VHD) in Hyper-V without additional programs?
” Essentially, you create an object to link to the Msvm_ImageManagementService class, then mount the VHD via the object. The following command creates the object to point to the class.
$objVHDService = get-wmiobject -class "Msvm_ImageManagementService" -<br>namespace "root\virtualization" -computername "."
You can then mount a VHD by using this command:
To unmount, you just use this command:
The following screen shows the results of these commands: