Windows Server 2016 – Hyper-V edit virtual disk with PowerShell

Compact a vhd with optimize-vhd:

optimize-vhd -path c:\vm2.vhdx -mode full  
#the vhd should not be a fixed vhd

, <span>Windows Server 2016 – Hyper-V edit virtual disk with PowerShell</span>, KandZ

More info about optimize-vhd here.

 

Convert a vhd with convert-vhd:

convert-vhd -path c:\vm2.vhdx -destinationpath c:\vm2converted.vhdx -vhdtype fixed
# 3 options for vhdtype:Fixed | Dynamic | Differencing.

, <span>Windows Server 2016 – Hyper-V edit virtual disk with PowerShell</span>, KandZ

More info about convert-vhd here.

 

Resize a vhd with resize-vhd:

resize-vhd -path c:\vm2.vhdx -sizebytes 10gb
# shrink operation is allowed only on VHDX
# VHD should not be attached

, <span>Windows Server 2016 – Hyper-V edit virtual disk with PowerShell</span>, KandZ

More info about resize-vhd here.

Merge a differencing disk into its parent vhd use merge-vhd:

merge-vhd -path c:\diffvhd.vhdx -destinationpath c:\vm2.vhdx

, <span>Windows Server 2016 – Hyper-V edit virtual disk with PowerShell</span>, KandZ

More info about merge-vhd here.

 

 

https://kandz.me/?p=3029

30290cookie-checkWindows Server 2016 – Hyper-V edit virtual disk with PowerShellWindows Server 2016 – Hyper-V edit virtual disk with PowerShell

Related posts

One Thought to “Windows Server 2016 – Hyper-V edit virtual disk with PowerShell

Comments are closed.