Skip to content

Commit 7da457e

Browse files
authored
4.1.0 (#76)
* 4.1.0-1 * 4.1.0-2
1 parent 4c71b08 commit 7da457e

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Invoke-CMApplyDriverPackage.ps1

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
Author: Nickolaj Andersen / Maurice Daly
108108
Contact: @NickolajA / @MoDaly_IT
109109
Created: 2017-03-27
110-
Updated: 2020-09-16
110+
Updated: 2021-02-16
111111
112112
Contributors: @CodyMathis123, @JamesMcwatty
113113
@@ -193,6 +193,7 @@
193193
4.0.7 - (2020-10-27) - Updated with support for Windows 10 version 2009.
194194
4.0.8 - (2020-12-09) - Added new functionality to be able to read a custom Application ID URI, if the default of https://ConfigMgrService is not defined on the ServerApp.
195195
4.0.9 - (2020-12-10) - Fixed default parameter set to "BareMetal"
196+
4.1.0 - (2021-02-16) - Added support for new Windows 10 build version naming scheme, such as 20H2, 21H1 and so on.
196197
#>
197198
[CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName = "BareMetal")]
198199
param(
@@ -250,7 +251,7 @@ param(
250251
[parameter(Mandatory = $true, ParameterSetName = "Debug")]
251252
[parameter(Mandatory = $false, ParameterSetName = "XMLPackage")]
252253
[ValidateNotNullOrEmpty()]
253-
[ValidateSet("2009", "2004", "1909", "1903", "1809", "1803", "1709", "1703", "1607")]
254+
[ValidateSet("21H2", "21H1", "20H2", "2004", "1909", "1903", "1809", "1803", "1709", "1703", "1607")]
254255
[string]$TargetOSVersion,
255256

256257
[parameter(Mandatory = $false, ParameterSetName = "BareMetal", HelpMessage = "Define the value that will be used as the target operating system architecture e.g. 'x64'.")]
@@ -294,7 +295,7 @@ param(
294295

295296
[parameter(Mandatory = $false, ParameterSetName = "Debug", HelpMessage = "Override the automatically detected computer manufacturer when running in debug mode.")]
296297
[ValidateNotNullOrEmpty()]
297-
[ValidateSet("Hewlett-Packard", "HP", "Dell", "Lenovo", "Microsoft", "Fujitsu", "Panasonic", "Viglen", "AZW")]
298+
[ValidateSet("HP", "Hewlett-Packard", "Dell", "Lenovo", "Microsoft", "Fujitsu", "Panasonic", "Viglen", "AZW")]
298299
[string]$Manufacturer,
299300

300301
[parameter(Mandatory = $false, ParameterSetName = "Debug", HelpMessage = "Override the automatically detected computer model when running in debug mode.")]
@@ -960,7 +961,7 @@ Process {
960961
)
961962
switch (([System.Version]$InputObject).Build) {
962963
"19042" {
963-
$OSVersion = 2009
964+
$OSVersion = 20H2
964965
}
965966
"19041" {
966967
$OSVersion = 2004
@@ -1278,7 +1279,7 @@ Process {
12781279
[ValidateNotNullOrEmpty()]
12791280
[System.Object[]]$DriverPackage,
12801281

1281-
[parameter(Mandatory = $false, HelpMessage = "Set to True to check for drivers packages that matches earlier versions of Windows than what's detected from web service call.")]
1282+
[parameter(Mandatory = $false, HelpMessage = "Set to True to check for drivers packages that matches earlier versions of Windows than what's detected from admin service call.")]
12821283
[ValidateNotNullOrEmpty()]
12831284
[bool]$OSVersionFallback = $false
12841285
)
@@ -1348,7 +1349,7 @@ Process {
13481349
}
13491350

13501351
# Add driver package OS version details to custom driver package details object
1351-
if ($DriverPackageItem.Name -match "^.*Windows.*(?<OSVersion>(\d){4}).*") {
1352+
if ($DriverPackageItem.Name -match "^.*Windows.*(?<OSVersion>(\d){4}).*|^.*Windows.*(?<OSVersion>(\d){2}(\D){1}(\d){1}).*") {
13521353
$DriverPackageDetails.OSVersion = $Matches.OSVersion
13531354
}
13541355

@@ -1566,7 +1567,11 @@ Process {
15661567
[bool]$OSVersionFallback = $false
15671568
)
15681569
if ($OSVersionFallback -eq $true) {
1569-
if ([int]$DriverPackageInput -lt [int]$OSImageData.Version) {
1570+
# Attempt to convert 2XHX build version into digit, 2XH1 into 2X05 and 2XH2 into 2X10 for simplified version comparison
1571+
$DriverPackageInputConversion = $DriverPackageInput.Replace("H1", "05").Replace("H2", 10)
1572+
$OSImageDataVersionConversion = $OSImageData.Version.Replace("H1", "05").Replace("H2", 10)
1573+
1574+
if ([int]$DriverPackageInputConversion -lt [int]$OSImageDataVersionConversion) {
15701575
# OS version match found where driver package input was less than input from OSImageData version
15711576
Write-CMLogEntry -Value " - Matched operating system version: $($DriverPackageInput)" -Severity 1
15721577
return $true

0 commit comments

Comments
 (0)