Context
I wanted to test the new Windows 11 released on Hyper-V
The readiness script reported that both storage and TPM are missing 😥
Here’s what I did to get a PASS on all the hardware prerequisites on the VM:
~\Downloads\HardwareReadiness.ps1|Out-String | ConvertFrom-Json

Solution
$VMName = 'MyVMName'
# 1. Add Secure boot
Get-VM -Name $VMName |
Set-VMFirmware -EnableSecureBoot:On -SecureBootTemplate 'MicrosoftWindows'
# 2. Add a TPM
Set-VMKeyProtector -VMName $VMName -NewLocalKeyProtector
Enable-VMTPM -VMName $VMName
# 3. Resize VHDX
Get-VMHardDiskDrive -VMName $VMName |
Select -First 1 -ExpandProperty Path | Get-VHD |
Resize-VHD -SizeBytes 65GB

Inside the VM, I had to extend the C: drive
# Remove the offending 5th partition
$null = Remove-Partition -DiskNumber 0 -PartitionNumber 5 -Confirm:$false
# Resize C: to the maximum
Resize-Partition -DiskNumber 0 -PartitionNumber 4 -Size (Get-PartitionSupportedSize -DiskNumber 0 -PartitionNumber 4).SizeMax

A return code of 0 means the VM is Windows 11 capable 😎

Pingback: Dew Drop – October 11, 2021 (#3534) – Morning Dew by Alvin Ashcraft
Pingback: Dew Drop – October 11, 2021 (#3534) - Online Code Generator
Pingback: ➧Dew Drop – October 11, 2021 (#3534) • Softbranchdevelopers