Automation · Hyper-V Automation
VHDX
Cheat sheet · https://pcornel.dk/topic.php?topic=5714
Answer
VHDX automation creates and changes virtual disks with New-VHD, Resize-VHD, Convert-VHD, Mount-VHD and Optimize-VHD, and attaches them with Add-VMHardDiskDrive.
Remember
- New-VHD, Resize-VHD, Convert-VHD.
- Resize may need the guest to extend partitions.
- Optimize-VHD compacts dynamic disks.
First checks
New-VHD -Path <p> -SizeBytes 100GB -Dynamic— createResize-VHD -Path <p> -SizeBytes 200GB— growGet-VHD <p>— inspect
Verify in this order
VHDX operation → verify size/type
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5714