Monday, April 6, 2009

How to Mount Disks to your physical Machine using Powershell

1st you have to have HyperV Role installed

define the ImageManagementService Class as Variable

$Disk=Get-WmiObject Msvm_ImageManagementService -namespace "root\virtualization" –computername .

Call mount method which require only the full path for your vhd drive like the example below:

$disk.mount("C:\Program Files\Microsoft Learning\50028B\Drives\50028-DC1-Data.vhd")

once the command succeed you will see like new drive is being installed in your notification area

image

the problem now that the disk is currently offline like the disk 2 in the image below so we have to bring online and then assign Drive letter.

image

we can do this also by Powershell but it is very long I will add it later.