Which PowerShell cmdlet option you should run first?

You run a Windows 2012 R2 Hyper-V Role Server, you need to shrink the size of files.vhd.
Which PowerShell cmdlet option you should run first?

You run a Windows 2012 R2 Hyper-V Role Server, you need to shrink the size of files.vhd.
Which PowerShell cmdlet option you should run first?

A.
Dismount-VHD

B.
Mount-VHD

C.
Resize-VHD

D.
Convert-VHD



Leave a Reply 2

Your email address will not be published. Required fields are marked *

14 − four =


Harutyun Sardaryan

Harutyun Sardaryan

https://technet.microsoft.com/en-us/library/hh848535.aspx

The Resize-VHD cmdlet resizes a virtual hard disk. This cmdlet lets you shrink or expand the size of a virtual hard disk, but the shrink operation is allowed only on VHDX virtual hard disks.

Resize-VHD is an offline operation; the virtual hard disk must not be attached when the operation is initiated.

So the correct answer is A – Dismount-VHD, then you can convert it to vhdx and then resize (shrink).

URwellWisher

URwellWisher

I will go with Convert-VHD

I do not find dismount-VHD cmdlet in PS though one of the MS documents mention about it.
Not sure what OS version this applies to : https://technet.microsoft.com/en-us/itpro/powershell/windows/hyper-v/dismount-vhd

I can find dismount-diskimage which can remove VHD.
Or the other option is via GUI to detach VHD.

https://www.sapien.com/powershell/cmdlet/230/dismount-diskimage/ModuleName

https://social.technet.microsoft.com/Forums/windowsserver/en-US/cb9d20d8-264b-4a75-affc-e4360ab9dd55/cant-dismount-vhd?forum=winserver8gen