Refactor driver handling and remove preview update option

Removes the parameter for installing preview cumulative updates to simplify the script's interface.

Improves logging during the driver copy process to provide better visibility into which drivers are being used.

The UI no longer loads the selected device 'Make' from the configuration on startup.
This commit is contained in:
rbalsleyMSFT
2025-06-27 09:34:25 -07:00
parent dfe07b16ae
commit dcb7957d15
2 changed files with 10 additions and 11 deletions
+8 -9
View File
@@ -153,9 +153,6 @@ When set to $true, will download and install the latest Microsoft Edge for Windo
.PARAMETER UpdateLatestCU .PARAMETER UpdateLatestCU
When set to $true, will download and install the latest cumulative update for Windows 10/11. Default is $false. When set to $true, will download and install the latest cumulative update for Windows 10/11. Default is $false.
.PARAMETER UpdatePreviewCU
When set to $true, will download and install the latest Preview cumulative update for Windows 10/11. Default is $false.
.PARAMETER UpdateLatestDefender .PARAMETER UpdateLatestDefender
When set to $true, will download and install the latest Windows Defender definitions and Defender platform update. Default is $false. When set to $true, will download and install the latest Windows Defender definitions and Defender platform update. Default is $false.
@@ -3346,9 +3343,11 @@ Function New-DeploymentUSB {
if ($CopyDrivers) { if ($CopyDrivers) {
WriteLog "Copying drivers to $DeployPartitionDriveLetter\Drivers" WriteLog "Copying drivers to $DeployPartitionDriveLetter\Drivers"
if ($Make) { if ($Make) {
WriteLog "Copying drivers for make: $Make"
robocopy "$DriversFolder\$Make" "$DeployPartitionDriveLetter\Drivers" /E /R:5 /W:5 /J robocopy "$DriversFolder\$Make" "$DeployPartitionDriveLetter\Drivers" /E /R:5 /W:5 /J
} }
else { else {
WriteLog "No make specified, copying all drivers"
robocopy "$DriversFolder" "$DeployPartitionDriveLetter\Drivers" /E /R:5 /W:5 /J robocopy "$DriversFolder" "$DeployPartitionDriveLetter\Drivers" /E /R:5 /W:5 /J
} }
@@ -4000,10 +3999,10 @@ if ($driversJsonPath -and (Test-Path $driversJsonPath) -and ($InstallDrivers -or
if ($resultCode -eq 0 -and -not [string]::IsNullOrWhiteSpace($driverPath)) { if ($resultCode -eq 0 -and -not [string]::IsNullOrWhiteSpace($driverPath)) {
# The task was successful and returned a driver path. # The task was successful and returned a driver path.
$make = $makeLookup[$modelName] $makeJson = $makeLookup[$modelName]
if ($make) { if ($makeJson) {
$successfullyDownloaded.Add([PSCustomObject]@{ $successfullyDownloaded.Add([PSCustomObject]@{
Make = $make Make = $makeJson
Model = $modelName Model = $modelName
DriverPath = $driverPath DriverPath = $driverPath
}) })
@@ -4051,11 +4050,11 @@ if ($driversJsonPath -and (Test-Path $driversJsonPath) -and ($InstallDrivers -or
$modelName = if ($result.PSObject.Properties.Name -contains 'Identifier') { $result.Identifier } else { $result.Model } $modelName = if ($result.PSObject.Properties.Name -contains 'Identifier') { $result.Identifier } else { $result.Model }
# Find the 'Make' from the original list # Find the 'Make' from the original list
$make = $makeLookup[$modelName] $makeJson = $makeLookup[$modelName]
if ($make) { if ($makeJson) {
$successfullyDownloaded.Add([PSCustomObject]@{ $successfullyDownloaded.Add([PSCustomObject]@{
Make = $make Make = $makeJson
Model = $modelName Model = $modelName
DriverPath = $result.DriverPath DriverPath = $result.DriverPath
}) })
@@ -351,7 +351,7 @@ function Update-UIFromConfig {
Set-UIValue -ControlName 'chkInstallDrivers' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'InstallDrivers' -State $State Set-UIValue -ControlName 'chkInstallDrivers' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'InstallDrivers' -State $State
Set-UIValue -ControlName 'chkDownloadDrivers' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'DownloadDrivers' -State $State Set-UIValue -ControlName 'chkDownloadDrivers' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'DownloadDrivers' -State $State
Set-UIValue -ControlName 'chkCopyDrivers' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'CopyDrivers' -State $State Set-UIValue -ControlName 'chkCopyDrivers' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'CopyDrivers' -State $State
Set-UIValue -ControlName 'cmbMake' -PropertyName 'SelectedItem' -ConfigObject $ConfigContent -ConfigKey 'Make' -State $State # Set-UIValue -ControlName 'cmbMake' -PropertyName 'SelectedItem' -ConfigObject $ConfigContent -ConfigKey 'Make' -State $State
Set-UIValue -ControlName 'txtDriversFolder' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'DriversFolder' -State $State Set-UIValue -ControlName 'txtDriversFolder' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'DriversFolder' -State $State
Set-UIValue -ControlName 'txtPEDriversFolder' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'PEDriversFolder' -State $State Set-UIValue -ControlName 'txtPEDriversFolder' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'PEDriversFolder' -State $State
Set-UIValue -ControlName 'txtDriversJsonPath' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'DriversJsonPath' -State $State Set-UIValue -ControlName 'txtDriversJsonPath' -PropertyName 'Text' -ConfigObject $ConfigContent -ConfigKey 'DriversJsonPath' -State $State