When creating UEFI drive there is more than one partition, but Resize-VHDImage function assumes there is only one.
The error occurs, because Drive variable is an array not a single letter when there is more partitions.
$Drive = (Mount-VHD -Path $VirtualDiskPath -Passthru | Get-Disk | Get-Partition | Get-Volume).DriveLetter
Fast workaround is to change this line to:
$Drive = (Mount-VHD -Path $VirtualDiskPath -Passthru | Get-Disk | Get-Partition | Get-Volume | Where-Object FileSystemLabel -eq 'OS').DriveLetter
Real solution would be to detect correct partition. Maybe pick the one with the biggest size?
When creating UEFI drive there is more than one partition, but Resize-VHDImage function assumes there is only one.
The error occurs, because Drive variable is an array not a single letter when there is more partitions.
$Drive = (Mount-VHD -Path $VirtualDiskPath -Passthru | Get-Disk | Get-Partition | Get-Volume).DriveLetter
Fast workaround is to change this line to:
$Drive = (Mount-VHD -Path $VirtualDiskPath -Passthru | Get-Disk | Get-Partition | Get-Volume | Where-Object FileSystemLabel -eq 'OS').DriveLetter
Real solution would be to detect correct partition. Maybe pick the one with the biggest size?
STEPS TO REPRODUCE
ERROR MESSAGE