From 047881934af0aa9bc1f3ba8320eb7a196cefbb0d Mon Sep 17 00:00:00 2001 From: Doctair Date: Tue, 30 Jul 2024 13:57:54 -0400 Subject: [PATCH] Add Logic to catch the disk selection of USB External drives so that it will not accept a Letter --- FFUDevelopment/BuildFFUVM.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 7923cc0..b03eff3 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -2935,7 +2935,14 @@ Function Get-USBDrive { } $inputChoice = Read-Host "Enter the number corresponding to the external hard disk media drive you want to use" $selectedIndex = $inputChoice - 1 - $USBDrives = $ExternalHardDiskDrives[$selectedIndex] + + if ($selectedIndex -ge 0 -and $selectedIndex -lt $ExternalHardDiskDrives.Count) { + $USBDrives = $ExternalHardDiskDrives[$selectedIndex] + } else { + Write-Error "Invalid selection. Exiting." + exit 1 + } + } }