|
107 | 107 | Author: Nickolaj Andersen / Maurice Daly |
108 | 108 | Contact: @NickolajA / @MoDaly_IT |
109 | 109 | Created: 2017-03-27 |
110 | | - Updated: 2020-09-16 |
| 110 | + Updated: 2021-02-16 |
111 | 111 | |
112 | 112 | Contributors: @CodyMathis123, @JamesMcwatty |
113 | 113 | |
|
193 | 193 | 4.0.7 - (2020-10-27) - Updated with support for Windows 10 version 2009. |
194 | 194 | 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. |
195 | 195 | 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. |
196 | 197 | #> |
197 | 198 | [CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName = "BareMetal")] |
198 | 199 | param( |
@@ -250,7 +251,7 @@ param( |
250 | 251 | [parameter(Mandatory = $true, ParameterSetName = "Debug")] |
251 | 252 | [parameter(Mandatory = $false, ParameterSetName = "XMLPackage")] |
252 | 253 | [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")] |
254 | 255 | [string]$TargetOSVersion, |
255 | 256 |
|
256 | 257 | [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( |
294 | 295 |
|
295 | 296 | [parameter(Mandatory = $false, ParameterSetName = "Debug", HelpMessage = "Override the automatically detected computer manufacturer when running in debug mode.")] |
296 | 297 | [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")] |
298 | 299 | [string]$Manufacturer, |
299 | 300 |
|
300 | 301 | [parameter(Mandatory = $false, ParameterSetName = "Debug", HelpMessage = "Override the automatically detected computer model when running in debug mode.")] |
@@ -960,7 +961,7 @@ Process { |
960 | 961 | ) |
961 | 962 | switch (([System.Version]$InputObject).Build) { |
962 | 963 | "19042" { |
963 | | - $OSVersion = 2009 |
| 964 | + $OSVersion = 20H2 |
964 | 965 | } |
965 | 966 | "19041" { |
966 | 967 | $OSVersion = 2004 |
@@ -1278,7 +1279,7 @@ Process { |
1278 | 1279 | [ValidateNotNullOrEmpty()] |
1279 | 1280 | [System.Object[]]$DriverPackage, |
1280 | 1281 |
|
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.")] |
1282 | 1283 | [ValidateNotNullOrEmpty()] |
1283 | 1284 | [bool]$OSVersionFallback = $false |
1284 | 1285 | ) |
@@ -1348,7 +1349,7 @@ Process { |
1348 | 1349 | } |
1349 | 1350 |
|
1350 | 1351 | # 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}).*") { |
1352 | 1353 | $DriverPackageDetails.OSVersion = $Matches.OSVersion |
1353 | 1354 | } |
1354 | 1355 |
|
@@ -1566,7 +1567,11 @@ Process { |
1566 | 1567 | [bool]$OSVersionFallback = $false |
1567 | 1568 | ) |
1568 | 1569 | 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) { |
1570 | 1575 | # OS version match found where driver package input was less than input from OSImageData version |
1571 | 1576 | Write-CMLogEntry -Value " - Matched operating system version: $($DriverPackageInput)" -Severity 1 |
1572 | 1577 | return $true |
|
0 commit comments