Q. How can I mount a Virtual Hard Disk (VHD) from Windows PowerShell?

A. 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" -
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:

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.