Skip to content

Commit 917be6d

Browse files
committed
Release 19.10.29.0
Added support for packaging Surface Laptop 3 drivers. Note that the Surface Laptop 3 has 2 variants with different driver sets. Added a Version Number! The version number will be displayed in the logs at runtime.
1 parent 2075ff8 commit 917be6d

File tree

4 files changed

+63
-26
lines changed

4 files changed

+63
-26
lines changed

ExtraFiles/Scripts/CreateGlobalConditionsAndRequirements.ps1

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
$Windows10Versions = "10586", "14393", "15063", "16299", "17134", "17763", "18362", "18363"
1+
$Windows10Versions = "10586","14393","15063","16299","17134","17763","18362"
22
$ModelQueries = (Import-CSV "$PSScriptRoot\MicrosoftDrivers.csv").ModelName
3+
$SystemSKUQueries = (Import-CSV "$PSScriptRoot\MicrosoftDrivers.csv").SystemSKU
34
$ManufacturerQueries = "Microsoft Corporation"
45

56
if (-not (Get-Module ConfigurationManager)) {
@@ -29,6 +30,10 @@ if (-not (Get-CMGlobalCondition -Name "AutoPackage - Computer Model")) {
2930
New-CMGlobalConditionWqlQuery -DataType String -Class Win32_ComputerSystem -Namespace root\cimv2 -Property Model -Name "AutoPackage - Computer Model" -Description "Returns the Model from ComputerSystem\Model"
3031
}
3132

33+
if (-not (Get-CMGlobalCondition -Name "AutoPackage - Computer SystemSKU")) {
34+
New-CMGlobalConditionWqlQuery -DataType String -Class MS_SystemInformation -Namespace root\wmi -Property SystemSKU -Name "AutoPackage - Computer SystemSKU" -Description "Returns the SystemSKU from MS_SystemInformation"
35+
}
36+
3237
if (-not (Get-CMGlobalCondition -Name "AutoPackage - OSArchitecture x64")) {
3338
New-CMGlobalConditionWqlQuery -DataType String -Class Win32_OperatingSystem -Namespace root\cimv2 -Property OSArchitecture -WhereClause "OSArchitecture = `'64-bit`'" -Name "AutoPackage - OSArchitecture x64" -Description "Returns True if Win32_OperatingSystem is True. Use as existential rule for 64-bit operating system"
3439
}
@@ -64,7 +69,7 @@ if (Get-CMApplication -Name $Global:RequirementsTemplateAppName -Fast) {
6469
Add-LogContent "Processing - Add Windows 10 Versions to Template"
6570
foreach ($Version in $Windows10Versions) {
6671
if (-not ($ExistingRequirements -contains "AutoPackage - Windows 10 Build Number Integer Greater than or equal to $Version")) {
67-
Add-LogContent "$Version is being added"
72+
Add-LogContent "`"$Version`" is being added"
6873
$rule = Get-CMGlobalCondition -Name "AutoPackage - Windows 10 Build Number Integer" | New-CMRequirementRuleCommonValue -Value1 $Version -RuleOperator GreaterEquals
6974
$rule.Name = "AutoPackage - Windows 10 Build Number Integer Greater than or equal to $Version"
7075
Set-CMScriptDeploymentType -ApplicationName $Global:RequirementsTemplateAppName -DeploymentTypeName $ApplicationTemplateDTName -AddRequirement $rule
@@ -75,8 +80,8 @@ if (Get-CMApplication -Name $Global:RequirementsTemplateAppName -Fast) {
7580
Add-LogContent "Processing - Add Models to Template"
7681
foreach ($Model in $ModelQueries) {
7782
if (-not ($ExistingRequirements -contains "AutoPackage - Computer Model Equals $Model")) {
78-
Add-LogContent "$Model is being added"
79-
$rule = Get-CMGlobalCondition -Name "AutoPackage - Computer Model" | New-CMRequirementRuleCommonValue -Value1 $Model -RuleOperator IsEquals
83+
Add-LogContent "`"$Model`" is being added"
84+
$rule = Get-CMGlobalCondition -Name "AutoPackage - Computer Model" | New-CMRequirementRuleCommonValue -Value1 "$Model" -RuleOperator IsEquals
8085
$rule.Name = "AutoPackage - Computer Model Equals $Model"
8186
Set-CMScriptDeploymentType -ApplicationName $Global:RequirementsTemplateAppName -DeploymentTypeName $ApplicationTemplateDTName -AddRequirement $rule
8287
}
@@ -86,12 +91,24 @@ if (Get-CMApplication -Name $Global:RequirementsTemplateAppName -Fast) {
8691
Add-LogContent "Processing - Add Manufacturers to Template"
8792
foreach ($Manufacturer in $ManufacturerQueries) {
8893
if (-not ($ExistingRequirements -contains "AutoPackage - Computer Manufacturer Equals $Manufacturer")) {
89-
Add-LogContent "$Manufacturer is being added"
90-
$rule = Get-CMGlobalCondition -Name "AutoPackage - Computer Manufacturer" | New-CMRequirementRuleCommonValue -Value1 $Manufacturer -RuleOperator IsEquals
94+
Add-LogContent "`"$Manufacturer`" is being added"
95+
$rule = Get-CMGlobalCondition -Name "AutoPackage - Computer Manufacturer" | New-CMRequirementRuleCommonValue -Value1 "$Manufacturer" -RuleOperator IsEquals
9196
$rule.Name = "AutoPackage - Computer Manufacturer Equals $Manufacturer"
9297
Set-CMScriptDeploymentType -ApplicationName $Global:RequirementsTemplateAppName -DeploymentTypeName $ApplicationTemplateDTName -AddRequirement $rule
9398
}
9499
}
100+
101+
Add-LogContent "Processing - Add SystemSKU to Template"
102+
foreach ($SystemSKU in $($SystemSKUQueries | where-object {$_ -ne ""})) {
103+
$SystemSKUSplit = $SystemSKU.Split(",")
104+
$SystemSKU = $SystemSKU.Replace(',',', ')
105+
if (-not ($ExistingRequirements -contains "AutoPackage - Computer SystemSKU OneOf {$SystemSKU}")) {
106+
Add-LogContent "`"$SystemSKU`" is being added"
107+
$rule = Get-CMGlobalCondition -Name "AutoPackage - Computer SystemSKU" | New-CMRequirementRuleCommonValue -Value1 $SystemSKUSplit -RuleOperator OneOf
108+
$rule.Name = "AutoPackage - Computer SystemSKU OneOf {$SystemSKU}"
109+
Set-CMScriptDeploymentType -ApplicationName $Global:RequirementsTemplateAppName -DeploymentTypeName $ApplicationTemplateDTName -AddRequirement $rule
110+
}
111+
}
95112
} Else {
96113
Add-LogContent "WARN: The Requirements Application is being created, please run the SCCMPackager again to finish prerequisite setup and begin packaging software."
97114
$Global:TemplateApplicationCreatedFlag = $true

ExtraFiles/Scripts/CreateMicrosoftDriverRecipes.ps1

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ $ModelList = Import-CSV -Path "$PSScriptRoot\MicrosoftDrivers.csv"
33
Foreach ($ModeltoProcess in $ModelList) {
44
$Model = $ModeltoProcess.ModelName
55
$Downloadid = $ModeltoProcess.linkId
6+
$SystemSKU = ($ModeltoProcess.SystemSKU).Replace(',', ', ')
67
$ModelShortName = $Model.Replace(' ', '')
78
$DownloadLink = "https://www.microsoft.com/en-us/download/confirmation.aspx?id=$Downloadid"
89
$DocumentationLink = "https://www.microsoft.com/en-us/download/details.aspx?id=$Downloadid"
910

11+
# Special Processing for Models with the Same Model Query but Unique SystemSKU (SystemSKUs variable will determines if this is the case)
12+
#if ($Model -match "Surface Laptop 3"){
13+
# $Model = "Surface Laptop 3"
14+
#}
15+
1016
$AvailableDrivers = ((Invoke-WebRequest "$DownloadLink" -UseBasicParsing).Links | Where-Object href -like "*.msi" | Select-Object href -Unique).href
1117
$DriverNames = Split-Path $AvailableDrivers -Leaf | Sort-Object -Descending
1218
$AvailableWinVersions = @()
@@ -19,7 +25,18 @@ Foreach ($ModeltoProcess in $ModelList) {
1925
$AvailableWinVersions += $VersionNum
2026
}
2127
}
22-
$AppTemplate = (Get-Content "$PSScriptRoot\MicrosoftDriverRecipeTemplate.txt").Replace('%MODEL%', $Model).Replace('%MODELSHORTNAME%', $ModelShortName).Replace('%DOCUMENTATIONLINK%', $DocumentationLink).Replace('%DOWNLOADLINK%', $DownloadLink)
28+
29+
$AppTemplate = (Get-Content "$PSScriptRoot\MicrosoftDriverRecipeTemplate.txt").Replace('%MODELSHORTNAME%', $ModelShortName).Replace('%DOCUMENTATIONLINK%', $DocumentationLink).Replace('%DOWNLOADLINK%', $DownloadLink)
30+
31+
# Special Processing for Models with the Same Model Query but Unique SystemSKU
32+
if (-not ([System.String]::IsNullOrEmpty($SystemSKU))) {
33+
Add-LogContent "$Model requires SKUs instead of Model Queries - $SystemSKUs"
34+
$TextToReplace = "<RuleName>AutoPackage - Computer Model Equals %MODEL%</RuleName>"
35+
$TextToAdd = "<RuleName>AutoPackage - Computer SystemSKU OneOf {$SystemSKU}</RuleName>"
36+
$AppTemplate = $AppTemplate.Replace($TextToReplace, $TextToAdd)
37+
}
38+
39+
$AppTemplate = $AppTemplate.Replace('%MODEL%', $Model)
2340
[xml]$AppRecipe = $AppTemplate
2441

2542
# Choose only the 3 latest versions of Windows 10
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
ModelName,LinkID
2-
Surface Book,49497
3-
Surface Book 2,56261
4-
Surface Go,57439
5-
Surface Laptop,55489
6-
Surface Laptop 2,57515
7-
Surface Pro 3,38826
8-
Surface Pro 4,49498
9-
Surface Pro 6,57514
10-
Surface Studio,54311
11-
Surface Studio 2,57593
12-
Surface Pro,55484
13-
Surface 3,49040
14-
Surface Pro 7,100419
1+
ModelName,LinkID,SystemSKU
2+
Surface Book,49497,
3+
Surface Book 2,56261,
4+
Surface Go,57439,
5+
Surface Laptop,55489,
6+
Surface Laptop 2,57515,
7+
Surface Pro 3,38826,
8+
Surface Pro 4,49498,
9+
Surface Pro 6,57514,
10+
Surface Studio,54311,
11+
Surface Studio 2,57593,
12+
Surface Pro,55484,
13+
Surface 3,49040,
14+
Surface Pro 7,100419,
15+
Surface Laptop 3 (Intel),100429,"Surface_Laptop_3_1867:1868,Surface_Laptop_3_1872"
16+
Surface Laptop 3 (AMD),100428,Surface_Laptop_3_1873

SCCMPackager.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
.NOTES
33
===========================================================================
44
Created on: 1/9/2018 11:34 AM
5-
Last Updated: 6/7/2019 9:38 AM
5+
Last Updated: 10/29/2019
66
Author: Andrew Jimenez (asjimene) - https://github.com/asjimene/
77
Filename: SCCMPackager.ps1
8-
Version: 2.3.1
98
===========================================================================
109
.DESCRIPTION
1110
Packages Applications for SCCM using XML Based Recipe Files
@@ -19,6 +18,8 @@
1918
7-Zip Binary - Igor Pavlov - https://www.7-zip.org/
2019
#>
2120

21+
$Global:ScriptVersion = "19.10.29.0"
22+
2223
$Global:ScriptRoot = $PSScriptRoot
2324

2425
## Global Variables
@@ -541,10 +542,10 @@ Function Copy-CMDeploymentTypeRule {
541542
}
542543

543544
$Available = ($SourceApplication.DeploymentTypes[0].Requirements).Name
544-
Add-LogContent "Available Requirements to chose from:`r`n $($Available -Join '`r`n')"
545+
Add-LogContent "Available Requirements to chose from:`r`n $($Available -Join ', ')"
545546

546547
# get requirement rules from source application
547-
$Requirements = $SourceApplication.DeploymentTypes[0].Requirements | Where-Object { ($_.Name).TrimStart().TrimEnd() -eq $RuleName }
548+
$Requirements = $SourceApplication.DeploymentTypes[0].Requirements | Where-Object { ($_.Name).TrimStart().TrimEnd() -eq $RuleName.TrimStart().TrimEnd() }
548549
if (-not ([System.String]::IsNullOrEmpty($Requirements))) {
549550
Add-LogContent "No Requirement rule was an exact match for $RuleName"
550551
$Requirements = $SourceApplication.DeploymentTypes[0].Requirements | Where-Object { $_.Name -match $RuleName }
@@ -1107,7 +1108,7 @@ Function Send-EmailMessage {
11071108

11081109
################################### MAIN ########################################
11091110
## Startup
1110-
Add-LogContent "--- Starting SCCM AutoPackager ---" -Load
1111+
Add-LogContent "--- Starting SCCM AutoPackager Version $($Global:ScriptVersion) ---" -Load
11111112
if (-not (Get-Module ConfigurationManager)) {
11121113
try {
11131114
Add-LogContent "Importing ConfigurationManager Module"

0 commit comments

Comments
 (0)