Add Logic to catch the disk selection of USB

External drives so that it will not accept a Letter
This commit is contained in:
Doctair
2024-07-30 13:57:54 -04:00
parent 689808eca7
commit 047881934a
+8 -1
View File
@@ -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" $inputChoice = Read-Host "Enter the number corresponding to the external hard disk media drive you want to use"
$selectedIndex = $inputChoice - 1 $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
}
} }
} }