From 08452f740b0adc1ffd863e6ea86885d4cd7bc835 Mon Sep 17 00:00:00 2001 From: Leo Neubecker Date: Mon, 9 Feb 2026 23:27:59 +0100 Subject: [PATCH] Fix error when mounting VM with multiple drives --- FastGPU-P/Form1.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FastGPU-P/Form1.cs b/FastGPU-P/Form1.cs index c4e777b..6e7e25f 100644 --- a/FastGPU-P/Form1.cs +++ b/FastGPU-P/Form1.cs @@ -213,7 +213,8 @@ Function Add-VMGpuPartitionAdapterFiles { } ""Mounting Drive..."" -$DiskNumber = (Mount-VHD -NoDriveLetter -Path $VHD.Path -PassThru | Get-Disk).Number +$VHDPath = if($VHD.Path -is [string]) {$VHD.Path} else {$VHD.Path[0]} +$DiskNumber = (Mount-VHD -NoDriveLetter -Path $VHDPath -PassThru | Get-Disk).Number $PartitionNumber = (Get-Partition -DiskNumber $DiskNumber | Where-Object {$_.Type -eq ""Basic""}).PartitionNumber $UsedLetters = Get-CimInstance -ClassName Win32_LogicalDisk | Select-Object -ExpandProperty DeviceID | ForEach-Object { $_.ToString()[0] } $DriveLetter = [char[]](67..90) | Where-Object { $_ -notin $UsedLetters } | Select-Object -First 1 @@ -223,7 +224,7 @@ Function Add-VMGpuPartitionAdapterFiles { Add-VMGPUPartitionAdapterFiles -hostname $Hostname -DriveLetter $DriveLetter -GPUName $GPUName ""Dismounting Drive..."" -Dismount-VHD -Path $VHD.Path +Dismount-VHD -Path $VHDPath If ($state_was_running){ ""Previous State was running so starting VM...""