diff --git a/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Editions.ps1 b/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Editions.ps1 new file mode 100644 index 0000000..0fc256c --- /dev/null +++ b/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Editions.ps1 @@ -0,0 +1,78 @@ +<# +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +#> + +<# +.SYNOPSIS +Decline updates for editions of Windows 11 your organization does not support. +.DESCRIPTION +Decline updates for editions of Windows 11 your organization does not support. +.NOTES +You must un-comment the $SupportedEditions variable and add the editions your organization supports. +The KnownEditions variable holds a list of known editions to _try_ and prevent the script from going rogue if MS decides to change the naming scheme. If ... or when ... they do this will need to be updated. +Written By: Damien Solodow +Version 1.0: 01/15/2024 +#> + +#Un-comment and add elements to this array for editions you support. Be sure to add a comma at the end in order to avoid confusion between editions. +#$SupportedEditions = @("Windows 11 \(business editions\),","Upgrade to Windows 11 \(business editions\)") + +#If Microsoft decides to change their naming scheme you will need to update this variable to support the new scheme. Note that commas are used to prevent mismatches. +$KnownEditions = @( + 'Upgrade to Windows 11 \(business editions\)', + 'Upgrade to Windows 11 \(consumer editions\)' + 'Windows 11 \(consumer editions\),' + 'Windows 11 \(business editions\),' +) +Function Invoke-SelectUpdatesPlugin{ + + $DeclineUpdates = @{} + If (!$SupportedEditions){ + Return $DeclineUpdates + } + + + $Windows11Updates = $ActiveUpdates | Where-Object{$_.ProductTitles.Contains('Windows 11')} + + #Loop through the updates and decline any that match the version. + ForEach ($Update in $Windows11Updates){ + + #Verify that the title matches one of the known edition. If not then skip the update. + $EditionFound = $False + ForEach ($Edition in $KnownEditions){ + If ($Update.Title -match $Edition){ + $EditionFound = $True + } + } + If(!$EditionFound){ + Continue + } #Skip to the next update. + + #Verify that the title does not match any of the editions the user supports. + $EditionFound = $False + ForEach ($Edition in $SupportedEditions){ + If ($Update.Title -match $Edition){ + $EditionFound = $True + } + } + + #If one of the supported editions was found then skip to the next update. + If($EditionFound -or (Test-Exclusions $Update)){ + Continue #Skip to the next update. + } Else { + $DeclineUpdates.Set_Item($Update.Id.UpdateId, 'Windows 11 Edition') + } + } + Return $DeclineUpdates +} diff --git a/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Languages.ps1 b/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Languages.ps1 new file mode 100644 index 0000000..e662e2c --- /dev/null +++ b/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Languages.ps1 @@ -0,0 +1,68 @@ +<# +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +#> + +<# +.SYNOPSIS +Decline Windows 11 updates based on language. +.DESCRIPTION +Decline Windows 11 updates for languages that are not selected to download software update files in the Software Update Point component. +.NOTES +If you are using stand-alone WSUS be sure to modify the SupportedUpdateLanguages variable to hard code the languages you support. +Be sure to always include an 'all' element for language-independant updates. + + +Written By: Damien Solodow +Version 1.0: 01/15/2024 +#> + + +Function Invoke-SelectUpdatesPlugin{ + + $DeclineUpdates = @{} + + #Determine how to create the supported update language array. + If ($StandAloneWSUS){ + $SupportedUpdateLanguages = @('en', 'all') + } Else{ + #Get the supported languages from the SUP component, exiting if it's not found, then add the 'all' language, and split them into an array. + $SupportedUpdateLanguages = ((Get-CMSoftwareUpdatePointComponent).Props).Where({$_.PropertyName -eq 'SupportedUpdateLanguages'}).Value2 + If (!$SupportedUpdateLanguages){ + Return $DeclineUpdates + } + $SupportedUpdateLanguages = ($SupportedUpdateLanguages.ToLower() + ',all').Split(',') + } + + + #Get the Windows 11 updates. + $Windows11Updates = $ActiveUpdates | Where-Object{($_.ProductTitles.Contains('Windows 11'))} + + #Loop through the updates and decline any that don't support the defined languages. + ForEach ($Update in $Windows11Updates){ + + #Loop through the updates's languages and determine if one of the defined languages is found. + $LanguageFound = $False + ForEach ($Language in $Update.GetSupportedUpdateLanguages()){ + If ($SupportedUpdateLanguages.Contains($Language)) { + $LanguageFound = $True + } + } + + #If none of the defined languages were found then decline the update. + If (! $LanguageFound -and (! (Test-Exclusions $Update))){ + $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Windows 11 Language: $($Update.GetSupportedUpdateLanguages())") + } + } + Return $DeclineUpdates +} diff --git a/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Versions.ps1 b/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Versions.ps1 new file mode 100644 index 0000000..88f2713 --- /dev/null +++ b/Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Versions.ps1 @@ -0,0 +1,59 @@ +<# +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +#> + +<# +.SYNOPSIS +Decline updates for defined versions of Windows 11. +.DESCRIPTION +Decline updates for defined versions of Windows 11. +.NOTES +You must un-comment the $UnsupportedVersions variable and add the versions your organization does not support. +Written By: Damien Solodow +Version 1.0: 01/15/2024 +#> + +#Un-comment and add elements to this array for versions you no longer support. +#$UnsupportedVersions = @("22H2") +Function Invoke-SelectUpdatesPlugin{ + + $DeclineUpdates = @{} + If (!$UnsupportedVersions){ + Return $DeclineUpdates + } + + $Windows11Updates = ($ActiveUpdates | Where-Object{ + $_.ProductTitles.Contains('Windows 11') + }) + + #Loop through the updates and decline any that match the version. + ForEach ($Update in $Windows11Updates){ + + #If the title contains a version number. + If ( + ($Update.Title -match 'Version \d\d\d\d') -or ($Update.Title -match 'Version \d\d[Hh][1-2]') -and + (! (Test-Exclusions $Update)) + ){ + + #Capture the version number. + $Version = $matches[0].Substring($matches[0].Length - 4) + + #If the version number is in the list then decline it. + If ($UnsupportedVersions.Contains($Version)){ + $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Windows 11 Version: $($Version)") + } + } + } + Return $DeclineUpdates +}