1717 Author: Maurice Daly
1818 Contact: @MoDaly_IT
1919 Created: 2017-12-03
20- Updated: 2017-12-05
20+ Updated: 2017-12-15
2121
2222 Version history:
2323
2424 1.0.0 - (2017-12-03) Script created
25- 1.0.1 - (2017-12-05) Updated Lenovo matching SKU value and added regex matching for Computer Model values.
25+ 1.0.1 - (2017-12-05) Updated Lenovo matching SKU value and added regex matching for Computer Model values
2626 1.0.2 - (2017-12-05) Updated to cater for language differences in OS architecture returned
27+ 1.0.3 - (2017-12-15) Updated OS architecture switch for futher language issues
28+ 1.0.4 - (2018-01-23) Corrected exit code message for Lenovo machines
2729#>
2830
2931# // =================== GLOBAL VARIABLES ====================== //
@@ -189,14 +191,13 @@ Write-CMLogEntry -Value "Operating system determined as: $OSName" -Severity 1
189191
190192# Get operating system architecture
191193switch - wildcard ((Get-CimInstance Win32_operatingsystem).OSArchitecture) {
192- " 64- *" {
194+ " 64*" {
193195 $OSArchitecture = " 64-Bit"
194196 }
195- " 32- *" {
197+ " 32*" {
196198 $OSArchitecture = " 32-Bit"
197199 }
198200}
199-
200201Write-CMLogEntry - Value " Architecture determined as: $OSArchitecture " - Severity 1
201202
202203$WindowsVersion = ($OSName ).Split(" " )[1 ]
@@ -565,14 +566,14 @@ function InitiateDownloads {
565566 ($_.Queries.smbios -match $SystemSKU -and $_.OS -match $WindowsVersion )
566567 }).driverPack | Where-Object {
567568 $_.id -eq " SCCM"
568- })." #text"
569+ })." #text" | Select-Object - Unique
569570 }
570571 else {
571572 $ComputerModelURL = (($global :LenovoModelDrivers.Product | Where-Object {
572573 ($_.Queries.Version -match (" ^" + $ComputerModel + " $" ) -and $_.OS -match $WindowsVersion )
573574 }).driverPack | Where-Object {
574575 $_.id -eq " SCCM"
575- })." #text"
576+ })." #text" | Select-Object - Unique
576577 }
577578 global:Write-CMLogEntry - Value " Info: Model URL determined as $ComputerModelURL " - Severity 1
578579 $DriverDownload = FindLenovoDriver - URI $ComputerModelURL - os $WindowsVersion - Architecture $OSArchitecture
@@ -582,7 +583,7 @@ function InitiateDownloads {
582583 global:Write-CMLogEntry - Value " Info: Driver cabinet download determined as $DriverDownload " - Severity 1
583584 }
584585 else {
585- global:Write-CMLogEntry - Value " Error: Unable to find driver for $Make $Model " - Severity 1
586+ global:Write-CMLogEntry - Value " Unsupported model / operating system combination found. Exiting. " - Severity 1
586587 }
587588 }
588589 }
0 commit comments