If a wrong package id (which is not a operating system image package) is defined in the task sequence variable OSImagePackageId the script failed with the following error during an OSD tasksequence: Snippet from smsts.log
<![LOG[===== SCConfigMgr Invoke-CMApplyDriverPackage Version 2.2.3 ====]LOG]!><time="11:08:20.230-60" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
<![LOG[Driver download package process initiated]LOG]!><time="11:08:20.27260" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
<![LOG[Manufacturer determined as: Hewlett-Packard]LOG]!><time="11:08:20.59660" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
<![LOG[Computer model determined as: HP EliteBook 840 G5]LOG]!><time="11:08:20.59760" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
<![LOG[Computer SKU determined as: 83B2]LOG]!><time="11:08:20.60060" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
<![LOG[Retrieved a total of 6 driver packages from web service]LOG]!><time="11:08:26.96160" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
<![LOG[Attempting to detect OS Image data from task sequence, running in DeploymentType: BareMetal]LOG]!><time="11:08:26.98160" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
<![LOG[Multiple OS Image objects detected. Objects will be matched against provided task sequence variable name 'OSImagePackageId' to determine the correct object]LOG]!><time="11:08:32.52960" date="11-04-2019" component="ApplyDriverPackage" context="NT AUTHORITY\SYSTEM" type="1" thread="2328" file="">
Root Cause
The function Get-OSImageData does not validate if the given PackageId is a valid Operating System Image package.
If the PackageId is not an Operating System Image package, the function does not return anything.
This results in an ParameterArgumentValidationError exception when the script runs the following line (Line 654):
The function Get-OSImageData now perform a check if the variable $PSCustomObject is null when trying to select the OS Image matching the value in the task sequence variable OSImageTsVariableName.
If the value is null, a log entry is created and the script exits with the exit code 4.
Bug Description
If a wrong package id (which is not a operating system image package) is defined in the task sequence variable
OSImagePackageId
the script failed with the following error during an OSD tasksequence:Snippet from smsts.log
ApplyDriverPackage.log
Root Cause
The function
Get-OSImageData
does not validate if the given PackageId is a valid Operating System Image package.If the PackageId is not an Operating System Image package, the function does not return anything. This results in an
ParameterArgumentValidationError
exception when the script runs the following line (Line 654):Solution Description
The function
Get-OSImageData
now perform a check if the variable$PSCustomObject
is null when trying to select the OS Image matching the value in the task sequence variableOSImageTsVariableName
.If the value is null, a log entry is created and the script exits with the exit code 4.