mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Add option to skip driver installation during deployment
Allows users to bypass driver installation by entering 0 at the selection prompt, providing flexibility for deployments that don't require driver updates. Introduces a skip flag and restructures the selection validation logic to accept either a valid driver selection or a skip command. When skipped, driver-related variables are set to null and appropriate logging messages are generated.
This commit is contained in:
@@ -1298,23 +1298,38 @@ if ($null -eq $DriverSourcePath) {
|
|||||||
}
|
}
|
||||||
$displayArray | Format-Table -Property Number, Type, RelativePath -AutoSize
|
$displayArray | Format-Table -Property Number, Type, RelativePath -AutoSize
|
||||||
|
|
||||||
|
$DriverSelected = -1
|
||||||
|
$skipDriverInstall = $false
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
$var = $true
|
$var = $true
|
||||||
[int]$DriverSelected = Read-Host 'Enter the number of the driver source to install'
|
[int]$userSelection = Read-Host 'Enter the number of the driver source to install (0 to skip)'
|
||||||
$DriverSelected = $DriverSelected - 1
|
if ($userSelection -eq 0) {
|
||||||
|
$skipDriverInstall = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
$DriverSelected = $userSelection - 1
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host 'Input was not in correct format. Please enter a valid number.'
|
Write-Host 'Input was not in correct format. Please enter a valid number.'
|
||||||
$var = $false
|
$var = $false
|
||||||
}
|
}
|
||||||
} until (($DriverSelected -ge 0) -and ($DriverSelected -lt $DriverSourcesCount) -and $var)
|
} until ((($DriverSelected -ge 0 -and $DriverSelected -lt $DriverSourcesCount) -or $skipDriverInstall) -and $var)
|
||||||
|
|
||||||
$DriverSourcePath = $DriverSources[$DriverSelected].Path
|
if ($skipDriverInstall) {
|
||||||
$DriverSourceType = $DriverSources[$DriverSelected].Type
|
$DriverSourcePath = $null
|
||||||
$selectedRelativePath = $DriverSources[$DriverSelected].RelativePath
|
$DriverSourceType = $null
|
||||||
WriteLog "User selected Type: $DriverSourceType, Path: $DriverSourcePath, RelativePath: $selectedRelativePath"
|
$selectedRelativePath = $null
|
||||||
Write-Host "`nUser selected Type: $DriverSourceType, RelativePath: $selectedRelativePath"
|
WriteLog 'User chose to skip driver installation.'
|
||||||
|
Write-Host "`nDriver installation was skipped."
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$DriverSourcePath = $DriverSources[$DriverSelected].Path
|
||||||
|
$DriverSourceType = $DriverSources[$DriverSelected].Type
|
||||||
|
$selectedRelativePath = $DriverSources[$DriverSelected].RelativePath
|
||||||
|
WriteLog "User selected Type: $DriverSourceType, Path: $DriverSourcePath, RelativePath: $selectedRelativePath"
|
||||||
|
Write-Host "`nUser selected Type: $DriverSourceType, RelativePath: $selectedRelativePath"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user