├── Export-OSDSUS.ps1 ├── Get-IntuneUpdateDeviceInfo.ps1 ├── Invoke-DGAAutomaticDeploymentRules.ps1 ├── Invoke-DGASoftwareUpdateMaintenance ├── Invoke-DGASoftwareUpdateMaintenance.ps1 ├── License.txt ├── Plugins │ └── Disabled │ │ ├── Decline-3rdPartyUpdates.ps1 │ │ ├── Decline-ByConfigMgrCustomSeverityOfLow.ps1 │ │ ├── Decline-ByConfigMgrFolder_To Decline.ps1 │ │ ├── Decline-Edge.ps1 │ │ ├── Decline-NotApprovedUpdatesOnUpstreamWSUS.ps1 │ │ ├── Decline-Office365Editions.ps1 │ │ ├── Decline-Windows10Editions.ps1 │ │ ├── Decline-Windows10Languages.ps1 │ │ ├── Decline-Windows10Versions.ps1 │ │ ├── Decline-Windows10Versions_MinusLTSB.ps1 │ │ ├── Decline-Windows11Editions.ps1 │ │ ├── Decline-Windows11Languages.ps1 │ │ ├── Decline-Windows11Versions.ps1 │ │ ├── Decline-Windows7IPUs.ps1 │ │ ├── Decline-WindowsARM64.ps1 │ │ ├── Decline-WindowsItanium.ps1 │ │ ├── Decline-WindowsX86.ps1 │ │ ├── Decline-WindowsX86_Minus2008.ps1 │ │ └── Template.ps1 ├── config.ini └── config_wsus_standalone.ini ├── Invoke-DGASoftwareUpdatePointSync.ps1 ├── License.txt └── README.md /Export-OSDSUS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | 19 | .DESCRIPTION 20 | 21 | .EXAMPLE 22 | powershell -executionpolicy bypass -file .\Export-OSDSUS.ps1 -OutPutFile "test.xml" -Title "x86" -Products "Windows 10,Windows 7" 23 | 24 | .NOTES 25 | 26 | 27 | .LINK 28 | http://www.damgoodadmin.com 29 | 30 | #> 31 | 32 | [CmdletBinding(SupportsShouldProcess=$True,DefaultParameterSetName="configfile")] 33 | Param( 34 | #Array of strings to search for and decline updates that match. Use wildcard operator (*) to match more than one update. 35 | [string] $Title, 36 | 37 | 38 | #Array of product strings that will be included and declined. This inclusion will apply to all methods of selecting updates to decline. Use wildcard operator (*) to match more than one update. 39 | [string[]] $Products, 40 | 41 | #Output the list of updates to this file. 42 | [string]$OutputFile="osdsusexport.xml", 43 | 44 | 45 | #Set the log file. 46 | [string]$LogFile, 47 | 48 | #The maximum size of the log in bytes. 49 | [int]$MaxLogSize = 2621440, 50 | 51 | #Define the sitecode. 52 | [string]$SiteCode, 53 | 54 | #Define a standalone WSUS server. 55 | [string]$StandAloneWSUS, 56 | 57 | #Define the standalone WSUS server port. 58 | [int]$StandAloneWSUSPort, 59 | 60 | #Define the standalone WSUS server's SSL setting. 61 | [bool]$StandAloneWSUSSSL = $False 62 | ) 63 | 64 | #region Functions 65 | Function Add-TextToCMLog { 66 | ########################################################################################################## 67 | <# 68 | .SYNOPSIS 69 | Log to a file in a format that can be read by Trace32.exe / CMTrace.exe 70 | 71 | .DESCRIPTION 72 | Write a line of data to a script log file in a format that can be parsed by Trace32.exe / CMTrace.exe 73 | 74 | The severity of the logged line can be set as: 75 | 76 | 1 - Information 77 | 2 - Warning 78 | 3 - Error 79 | 80 | Warnings will be highlighted in yellow. Errors are highlighted in red. 81 | 82 | The tools to view the log: 83 | 84 | SMS Trace - http://www.microsoft.com/en-us/download/details.aspx?id=18153 85 | CM Trace - Installation directory on Configuration Manager 2012 Site Server - \tools\ 86 | 87 | .EXAMPLE 88 | Add-TextToCMLog c:\output\update.log "Application of MS15-031 failed" Apply_Patch 3 89 | 90 | This will write a line to the update.log file in c:\output stating that "Application of MS15-031 failed". 91 | The source component will be Apply_Patch and the line will be highlighted in red as it is an error 92 | (severity - 3). 93 | 94 | #> 95 | ########################################################################################################## 96 | 97 | #Define and validate parameters 98 | [CmdletBinding()] 99 | Param( 100 | #Path to the log file 101 | [parameter(Mandatory=$True)] 102 | [String]$LogFile, 103 | 104 | #The information to log 105 | [parameter(Mandatory=$True)] 106 | [String]$Value, 107 | 108 | #The source of the error 109 | [parameter(Mandatory=$True)] 110 | [String]$Component, 111 | 112 | #The severity (1 - Information, 2- Warning, 3 - Error) 113 | [parameter(Mandatory=$True)] 114 | [ValidateRange(1,3)] 115 | [Single]$Severity 116 | ) 117 | 118 | 119 | #Obtain UTC offset 120 | $DateTime = New-Object -ComObject WbemScripting.SWbemDateTime 121 | $DateTime.SetVarDate($(Get-Date)) 122 | $UtcValue = $DateTime.Value 123 | $UtcOffset = $UtcValue.Substring(21, $UtcValue.Length - 21) 124 | 125 | 126 | #Create the line to be logged 127 | $LogLine = "" +` 128 | "" 135 | 136 | #Write the line to the passed log file 137 | Out-File -InputObject $LogLine -Append -NoClobber -Encoding Default -FilePath $LogFile -WhatIf:$False 138 | 139 | } 140 | ########################################################################################################## 141 | 142 | 143 | #Taken from https://stackoverflow.com/questions/5648931/test-if-registry-value-exists 144 | Function Test-RegistryValue { 145 | ########################################################################################################## 146 | <# 147 | .NOTES 148 | Taken from https://stackoverflow.com/questions/5648931/test-if-registry-value-exists 149 | #> 150 | Param( 151 | [Alias("PSPath")] 152 | [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] 153 | [String]$Path, 154 | [Parameter(Position = 1, Mandatory = $true)] 155 | [String]$Value, 156 | [Switch]$PassThru 157 | ) 158 | 159 | Process { 160 | If (Test-Path $Path) { 161 | $Key = Get-Item -LiteralPath $Path 162 | If ($Key.GetValue($Value, $null) -ne $null) { 163 | If ($PassThru) { 164 | Get-ItemProperty $Path $Value 165 | } Else { 166 | $True 167 | } 168 | } Else { 169 | $False 170 | } 171 | } Else { 172 | $False 173 | } 174 | } 175 | } 176 | ########################################################################################################## 177 | 178 | 179 | Function Get-SiteCode { 180 | ########################################################################################################## 181 | <# 182 | .SYNOPSIS 183 | Attempt to determine the current device's site code from the registry or PS drive. 184 | 185 | .DESCRIPTION 186 | When ran this function will look for the client's site. If not found it will look for a single PS drive. 187 | 188 | .EXAMPLE 189 | Get-SiteCode 190 | 191 | #> 192 | ########################################################################################################## 193 | 194 | #Try getting the site code from the client installed on this system. 195 | If (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\SMS\Identification" -Value "Site Code"){ 196 | $SiteCode = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\SMS\Identification" | Select-Object -ExpandProperty "Site Code" 197 | } ElseIf (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client" -Value "AssignedSiteCode") { 198 | $SiteCode = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client" | Select-Object -ExpandProperty "AssignedSiteCode" 199 | } 200 | 201 | #If the client isn't installed try looking for the site code based on the PS drives. 202 | If (-Not ($SiteCode) ) { 203 | #See if a PSDrive exists with the CMSite provider 204 | $PSDrive = Get-PSDrive -PSProvider CMSite -ErrorAction SilentlyContinue 205 | 206 | #If PSDrive exists then get the site code from it. 207 | If ($PSDrive.Count -eq 1) { 208 | $SiteCode = $PSDrive.Name 209 | } 210 | } 211 | 212 | Return $SiteCode 213 | } 214 | ########################################################################################################## 215 | 216 | Function Confirm-StringArray { 217 | ########################################################################################################## 218 | <# 219 | .SYNOPSIS 220 | Confirm that the string is not actually an array. 221 | 222 | .DESCRIPTION 223 | If a string array is passed with a single element containing commas then split the string into an array. 224 | 225 | #> 226 | ########################################################################################################## 227 | Param( 228 | [string[]] $StringArray 229 | ) 230 | 231 | If ($StringArray){ 232 | If ($StringArray.Count -eq 1){ 233 | If ($StringArray[0] -ilike '*,*'){ 234 | $StringArray = $StringArray[0].Split(",") 235 | Add-TextToCMLog $LogFile "The string array only had one element that contained commas. It has been split into $($StringArray.Count) separate elements." $component 2 236 | } 237 | } 238 | } 239 | Return $StringArray 240 | } 241 | ########################################################################################################## 242 | 243 | Function Get-WSUSDB{ 244 | ########################################################################################################## 245 | <# 246 | .SYNOPSIS 247 | Get the WSUS database configuration. 248 | 249 | .DESCRIPTION 250 | Use the WSUS api to get the database configuration and verify that you can successfully connect to the DB. 251 | 252 | #> 253 | ########################################################################################################## 254 | 255 | Param( 256 | [Parameter(Mandatory=$true)] 257 | [Microsoft.UpdateServices.Administration.IUpdateServer] $WSUSServer, 258 | [string] $LogFile ="Get-WSUSDB.log" 259 | ) 260 | 261 | $component = "Get-WSUSDB" 262 | 263 | Try{ 264 | $WSUSServerDB = $WSUSServer.GetDatabaseConfiguration() 265 | } 266 | Catch{ 267 | Add-TextToCMLog $LogFile "Failed to get the WSUS database details from the active SUP." $component 3 268 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 269 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 270 | Return 271 | } 272 | 273 | If (!($WSUSServerDB)){ 274 | Add-TextToCMLog $LogFile "Failed to get the WSUS database details from the active SUP." $component 3 275 | Return 276 | } 277 | 278 | #This is a just a test built into the API, it's not actually making the connection we'll use. 279 | Try{ 280 | $WSUSServerDB.ConnectToDatabase() 281 | Add-TextToCMLog $LogFile "Successfully tested the connection to the ($($WSUSServerDB.DatabaseName)) database on $($WSUSServerDB.ServerName)." $component 1 282 | } 283 | Catch{ 284 | Add-TextToCMLog $LogFile "Failed to connect to the ($($WSUSServerDB.DatabaseName)) database on $($WSUSServerDB.ServerName)." $component 3 285 | Add-TextToCMLog $LogFile "Error ($($_.Exception.HResult)): $($_.Exception.Message)" $component 3 286 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 287 | Return 288 | } 289 | 290 | Return $WSUSServerDB 291 | 292 | } 293 | 294 | Function Connect-WSUSDB{ 295 | ########################################################################################################## 296 | <# 297 | .SYNOPSIS 298 | Connect to the WSUS database. 299 | 300 | .DESCRIPTION 301 | Use the database configuration to connect to the DB. 302 | 303 | #> 304 | ########################################################################################################## 305 | 306 | Param( 307 | [Parameter(Mandatory=$true)] 308 | [Microsoft.UpdateServices.Administration.IDatabaseConfiguration] $WSUSServerDB, 309 | [string] $LogFile = "Connect-WSUSDB.log" 310 | ) 311 | 312 | $component = "Connect-WSUSDB" 313 | 314 | #Determine the connection string based on the type of DB being used. 315 | If ($WSUSServerDB.IsUsingWindowsInternalDatabase){ 316 | #Using the Windows Internal Database. 317 | 318 | If (!$StandAloneWSUS){Add-TextToCMLog $LogFile "Windows Internal Database? Fer real? Come one dawg ... just stop this insanity and migrate this to your ConfigMgr SQL instance." $component 2} 319 | 320 | If($WSUSServerDB.ServerName -eq "MICROSOFT##WID"){ 321 | $SqlConnectionString = "Data Source=\\.\pipe\MICROSOFT##WID\tsql\query;Integrated Security=True;Network Library=dbnmpntw" 322 | } 323 | Else{ 324 | $SqlConnectionString = "Data Source=\\.\pipe\microsoft##ssee\sql\query;Integrated Security=True;Network Library=dbnmpntw" 325 | } 326 | } 327 | Else{ 328 | #Connect to a real SQL database. 329 | $SqlConnectionString = "Server=$($WSUSServerDB.ServerName);Database=$($WSUSServerDB.DatabaseName);Integrated Security=True" 330 | } 331 | 332 | #Try to connect to the database. 333 | Try{ 334 | $SqlConnection = New-Object System.Data.SqlClient.SqlConnection($SqlConnectionString) 335 | $SqlConnection.Open() 336 | Add-TextToCMLog $LogFile "Successfully connected to the database." $component 1 337 | } 338 | Catch{ 339 | Add-TextToCMLog $LogFile "Failed to connect to the database using the connection string $($SqlConnectionString)." $component 3 340 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 341 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 342 | Return 343 | } 344 | 345 | Return $SqlConnection 346 | } 347 | 348 | #endregion 349 | 350 | $cmSiteVersion = [version]"5.00.8540.1000" 351 | $scriptVersion = "1.0.0" 352 | $component = 'Invoke-OsdSusExport' 353 | $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition 354 | 355 | #region Parameter validation 356 | #If log file is null then set it to the default and then make the provider type explicit. 357 | If (!$LogFile) { 358 | $LogFile = Join-Path $scriptPath "osdsusexport.log" 359 | } 360 | 361 | $LogFile = "filesystem::$($LogFile)" 362 | 363 | #If the log file exists and is larger then the maximum then roll it over. 364 | If (Test-path $LogFile -PathType Leaf) { 365 | If ((Get-Item $LogFile).length -gt $MaxLogSize){ 366 | Move-Item -Force $LogFile ($LogFile -replace ".$","_") -WhatIf:$False 367 | } 368 | } 369 | Add-TextToCMLog $LogFile "$component started (Version $($scriptVersion))." $component 1 370 | 371 | 372 | #Check to make sure we're running this on a primary site server that has the SMS namespace. 373 | If (!($StandAloneWSUS) -and !(Get-Wmiobject -namespace "Root" -class "__Namespace" -Filter "Name = 'SMS'")){ 374 | Add-TextToCMLog $LogFile "Currently, this script must be ran on a primary site server. When the CM 1706 reaches critical mass this requirement might be removed." $component 3 375 | Return 376 | } 377 | 378 | #Make sure the stand-alone WSUS parameters make sense. 379 | If (!$StandAloneWSUS -and ($StandAloneWSUSPort -or $StandAloneWSUSSSL)) { 380 | Add-TextToCMLog $LogFile "You may not use the StandAloneWSUSPort or StandAloneWSUSSSL parameters when not running against a stand-alone WSUS." $component 3 381 | Return 382 | } 383 | 384 | #If output file was given then make sure everything looks good. 385 | If ($OutputFile){ 386 | 387 | #If this was passed as a switch then use the default output file name. 388 | If (($OutputFile -is [Boolean]) -or ($OutputFile -eq 'True')){ 389 | $OutputFile = 'OutputFile.xml' 390 | } 391 | 392 | #If this was passed as a switch then use the default output file. 393 | If (![System.IO.Path]::IsPathRooted($OutputFile)){ 394 | $OutputFile = Join-Path $scriptPath $OutputFile 395 | } 396 | $OutputFile = "filesystem::$($OutputFile)" 397 | Write-Verbose "Output File: $OutputFile" 398 | } 399 | 400 | #Confirm that the string arrays are properly processed. 401 | $Products = Confirm-StringArray $Products 402 | #endregion 403 | 404 | #Change the directory to the site location. 405 | $OriginalLocation = Get-Location 406 | 407 | #Try to load the UpdateServices module. 408 | #NOTE: I initially tried using the WSUS Powershell module but it was exponentially slower than the API calls. Instead of a seconds it took hours to get the update list. 409 | Try { 410 | [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null 411 | } Catch { 412 | Add-TextToCMLog $LogFile "Failed to load the UpdateServices module." $component 3 413 | Add-TextToCMLog $LogFile "Please make sure that WSUS Admin Console is installed on this machine" $component 3 414 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 415 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 416 | } 417 | 418 | #Try and figure out WSUS connection details based on the parameters given. 419 | If ($StandAloneWSUS){ 420 | $WSUSFQDN = $StandAloneWSUS 421 | 422 | #If a port wasn't passed then set the default the port based on the SSL setting. 423 | If (!$StandAloneWSUSPort){ 424 | If ($StandAloneWSUSSSL){ 425 | $WSUSPort = 8531 426 | } 427 | Else{ 428 | $WSUSPort = 8530 429 | } 430 | } 431 | Else{ 432 | $WSUSPort = $StandAloneWSUSPort 433 | } 434 | 435 | $WSUSSSL = $StandAloneWSUSSSL 436 | 437 | } 438 | Else{ 439 | 440 | #If the Configuration Manager module exists then load it. 441 | If (! $env:SMS_ADMIN_UI_PATH) 442 | { 443 | Add-TextToCMLog $LogFile "The SMS_ADMIN_UI_PATH environment variable is not set. Make sure the Configuration Manager console it installed." $component 3 444 | Return 445 | } 446 | $configManagerCmdLetpath = Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) "ConfigurationManager.psd1" 447 | If (! (Test-Path $configManagerCmdLetpath -PathType Leaf) ) 448 | { 449 | Add-TextToCMLog $LogFile "The ConfigurationManager Module file could not be found. Make sure the Configuration Manager console it installed." $component 3 450 | Return 451 | } 452 | 453 | #You can't pass WhatIf to the Import-Module function and it spits out a lot of text, so work around it. 454 | $WhatIf = $WhatIfPreference 455 | $WhatIfPreference = $False 456 | Import-Module $configManagerCmdLetpath -Force 457 | $WhatIfPreference = $WhatIf 458 | 459 | #Get the site code 460 | If (!$SiteCode){$SiteCode = Get-SiteCode} 461 | 462 | #Verify that the site code was determined 463 | If (!$SiteCode){ 464 | Add-TextToCMLog $LogFile "Could not determine the site code. If you are running CAS you must specify the site code. Exiting." $component 3 465 | Return 466 | } 467 | 468 | #If the PS drive doesn't exist then try to create it. 469 | If (! (Test-Path "$($SiteCode):")) { 470 | Try{ 471 | Add-TextToCMLog $LogFile "Trying to create the PS Drive for site '$($SiteCode)'" $component 1 472 | New-PSDrive -Name $SiteCode -PSProvider CMSite -Root "." -WhatIf:$False | Out-Null 473 | } Catch { 474 | Add-TextToCMLog $LogFile "The site's PS drive doesn't exist nor could it be created." $component 3 475 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 476 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 477 | Return 478 | } 479 | } 480 | 481 | #Set and verify the location. 482 | Try{ 483 | Add-TextToCMLog $LogFile "Connecting to site: $($SiteCode)" $component 1 484 | Set-Location "$($SiteCode):" | Out-Null 485 | } Catch { 486 | Add-TextToCMLog $LogFile "Could not set location to site: $($SiteCode)." $component 3 487 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 488 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 489 | Return 490 | } 491 | 492 | #Make sure the site code exists on this server. 493 | $CMSite = Get-CMSite -SiteCode $SiteCode 494 | If (!$CMSite) { 495 | Add-TextToCMLog $LogFile "The site code $($SiteCode) could not be found." $component 3 496 | Return 497 | } 498 | 499 | #Verify the site version meets the requirement. 500 | If ($CMSite.Version -lt $cmSiteVersion){ 501 | Write-Warning "$($ModuleName) requires Configuration Manager $($cmSiteVersion.ToString()) or greater." 502 | } 503 | 504 | Try { 505 | 506 | #Determine the active SUP. 507 | $WSUSFQDN = (((Get-CMSoftwareUpdatePointComponent -SiteCode $SiteCode).Props) | Where-Object {$_.PropertyName -eq 'DefaultWSUS'}).Value2 508 | $ActiveSoftwareUpdatePoint = Get-CMSoftwareUpdatePoint -SiteCode $SiteCode -SiteSystemServerName $WSUSFQDN 509 | 510 | #Verify that an active SUP was found. 511 | If (!$ActiveSoftwareUpdatePoint){ 512 | Add-TextToCMLog $LogFile "The active software update point ($WSUSFQDN) could not be found." $component 3 513 | Set-Location $OriginalLocation 514 | Return 515 | } 516 | Add-TextToCMLog $LogFile "The active software update point is $WSUSFQDN." $component 1 517 | 518 | #Determine if the active SUP is using SSL and what port. 519 | $WSUSSSL = (($ActiveSoftwareUpdatePoint.Props) | Where-Object {$_.PropertyName -eq 'SSLWSUS'}).Value 520 | $WSUSPort = 8530 521 | If ($WSUSSSL){ 522 | $WSUSPort = (($ActiveSoftwareUpdatePoint.Props) | Where-Object {$_.PropertyName -eq 'WSUSIISSSLPort'}).Value 523 | Add-TextToCMLog $LogFile "Trying to connect to $WSUSFQDN on Port $WSUSPort using SSL." $component 1 524 | } Else { 525 | $WSUSPort = (($ActiveSoftwareUpdatePoint.Props) | Where-Object {$_.PropertyName -eq 'WSUSIISPort'}).Value 526 | Add-TextToCMLog $LogFile "Trying to connect to $WSUSFQDN on Port $WSUSPort." $component 1 527 | } 528 | } 529 | Catch { 530 | Add-TextToCMLog $LogFile "Failed to determine the active software update point." $component 3 531 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 532 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 533 | $WSUSServer = $null 534 | Set-Location $OriginalLocation 535 | Return 536 | } 537 | } #If Not StandAloneWSUS 538 | 539 | Try{ 540 | $WSUSServer = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WSUSFQDN, $WSUSSSL, $WSUSPort) 541 | } Catch { 542 | 543 | Add-TextToCMLog $LogFile "Failed to connect to the WSUS server $WSUSFQDN on port $WSUSPort with$(If(!$WSUSSSL){"out"}) SSL." $component 3 544 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 545 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 546 | $WSUSServer = $null 547 | Set-Location $OriginalLocation 548 | Return 549 | } 550 | 551 | #If the WSUS object is not instantiated then exit. 552 | If ($WSUSServer -eq $null) { 553 | Add-TextToCMLog $LogFile "Failed to connect." $component 3 554 | Add-TextToCMLog $LogFile "Please make sure that WSUS Admin Console is installed on this machine" $component 3 555 | Set-Location $OriginalLocation 556 | Return 557 | } 558 | 559 | Add-TextToCMLog $LogFile "Connected to WSUS server $WSUSFQDN." $component 1 560 | 561 | $WSUSServerDB = Get-WSUSDB $WSUSServer $LogFile 562 | If(!$WSUSServerDB) 563 | { 564 | Add-TextToCMLog $LogFile "Failed to get the WSUS database configuration." $component 3 565 | Set-Location $OriginalLocation 566 | Return 567 | } 568 | 569 | $UpdateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope 570 | $UpdateScope.TextIncludes = $Title 571 | 572 | if ($Products.Count -gt 0) 573 | { 574 | $UpdateCategoryCollection = New-Object Microsoft.UpdateServices.Administration.UpdateCategoryCollection 575 | $UpdateCategories = $WSUSServer.GetUpdateCategories() 576 | 577 | foreach( $UpdateCategory in $UpdateCategories) 578 | { 579 | foreach ($product in $Products) 580 | { 581 | if ($UpdateCategory.Title -eq $product) 582 | { 583 | Add-TextToCMLog $LogFile "Adding product to search: $product." $component 1 584 | $UpdateScope.Categories.Add($UpdateCategory) | Out-Null 585 | } 586 | } 587 | } 588 | } 589 | 590 | #Get a collection of all updates. 591 | Add-TextToCMLog $LogFile "Retrieving updates." $component 1 592 | Try { 593 | $AllUpdates = $WSUSServer.GetUpdates($UpdateScope) 594 | } Catch { 595 | Add-TextToCMLog $LogFile "Failed to get updates." $component 3 596 | Add-TextToCMLog $LogFile "If this operation timed out, try running the script with only the FirstRun parameter." $component 3 597 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $component 3 598 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 599 | Set-Location $OriginalLocation 600 | Return 601 | } 602 | 603 | Add-TextToCMLog $LogFile "Retrieved list of $($AllUpdates.Count) updates." $component 1 604 | 605 | $output = $AllUpdates | ConvertTo-Xml -NoTypeInformation 606 | $output.OuterXml | Out-File -FilePath $OutputFile 607 | 608 | Add-TextToCMLog $LogFile "$component finished." $component 1 609 | Add-TextToCMLog $LogFile "#############################################################################################" $component 1 610 | Set-Location $OriginalLocation 611 | Write-Output "The script completed successfully. Review the log file for detailed results." -------------------------------------------------------------------------------- /Get-IntuneUpdateDeviceInfo.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Determine if Device is in a given Intune filter. 4 | 5 | .DESCRIPTION 6 | Filters, how do they work?! 7 | 8 | .PARAMETER FilterId 9 | The Filter ID to test. 10 | 11 | .PARAMETER DeviceId 12 | The AzureAD Device ID of the device you wish to search for. 13 | 14 | .EXAMPLE 15 | Test-AssignmentFilter -FilterId ebaf5497-27z6-4bfb-ac98-aafc2317e42m -DeviceId a0e35867-744b-472r-9a90-df9c7d249623 16 | 17 | .NOTES 18 | #> 19 | function Test-AssignmentFilter { 20 | param( 21 | [Parameter(Mandatory = $true)] 22 | [string]$FilterId, 23 | 24 | [Parameter(Mandatory = $true)] 25 | [ValidateSet('include','exclude')] 26 | [string]$FilterType, 27 | 28 | [Parameter(Mandatory = $true)] 29 | [string]$DeviceId 30 | ) 31 | 32 | $uri = "https://graph.microsoft.com/beta/deviceManagement/assignmentFilters/$FilterId" 33 | Write-Debug "Calling $uri" 34 | $filterResponse = Invoke-MgGraphRequest -Uri $uri 35 | 36 | $tempFile = New-TemporaryFile 37 | $evalUri = "https://graph.microsoft.com/beta/deviceManagement/evaluateAssignmentFilter" 38 | $evalBody = @{ 39 | data = @{ 40 | platform = $filterResponse.platform 41 | rule = $filterResponse.rule 42 | search = $DeviceId 43 | } 44 | } 45 | Invoke-MgGraphRequest -Uri $evalUri -Method POST -Body $evalBody -OutputFilePath $tempFile 46 | $data = Get-Content $tempFile | ConvertFrom-Json -Depth 100 47 | Remove-Item $tempFile -Force -ErrorAction SilentlyContinue 48 | 49 | Write-Verbose "Filter Id: $FilterId`tFilterType:$FilterType`tDeviceId:$DeviceId`tRecords Found:$($data.TotalRowCount)" 50 | 51 | #The result is based on the type of filter and if records were found or not. 52 | if ($FilterType -eq 'include'){ 53 | return ($data.TotalRowCount -gt 0) 54 | } 55 | else{ 56 | return ($data.TotalRowCount -eq 0) 57 | } 58 | } 59 | 60 | <# 61 | .SYNOPSIS 62 | Determine if Device is in a given Intune filter. 63 | 64 | .DESCRIPTION 65 | Filters, how do they work?! 66 | 67 | .PARAMETER FilterId 68 | The Filter ID to test. 69 | 70 | .PARAMETER DeviceId 71 | The AzureAD Device ID of the device you wish to search for. 72 | 73 | .EXAMPLE 74 | Test-AssignmentFilter -FilterId ebaf5497-27z6-4bfb-ac98-aafc2317e42m -DeviceId a0e35867-744b-472r-9a90-df9c7d249623 75 | 76 | .NOTES 77 | #> 78 | function Test-Assignment { 79 | param( 80 | [Parameter(Mandatory = $true)] 81 | $Assignments, 82 | [Parameter(Mandatory = $true)] 83 | [string]$DeviceId 84 | ) 85 | 86 | #Determine if the device is excluded from the policy. 87 | $foundExclude = $false 88 | foreach ($assignment in $Assignments) 89 | { 90 | $target = $assignment.target 91 | if (($target.'@odata.type' -eq '#microsoft.graph.exclusionGroupAssignmentTarget') -and $aadDeviceGroups.ContainsKey($target.groupId)) { 92 | Write-Verbose "Processing exclude target $($target.groupId)" 93 | #If a filter was found, test to see if the device should be included in the policy. 94 | if ($null -ne $target.deviceAndAppManagementAssignmentFilterId){ 95 | if (Test-AssignmentFilter -FilterId $target.deviceAndAppManagementAssignmentFilterId -FilterType $target.deviceAndAppManagementAssignmentFilterType -DeviceId $intuneDeviceId ){ 96 | Write-Verbose "$(DeviceId) matched the filter" 97 | $foundExclude = $true 98 | break; 99 | } 100 | } 101 | #If no filter was found. 102 | else{ 103 | $foundExclude = $true 104 | break 105 | } 106 | } 107 | } 108 | #If an exclude was found, the skip to the next record 109 | if ($foundExclude) 110 | { 111 | Write-Verbose "Excluding deviceId $($DeviceId) from assignment $($assignment.id)" 112 | return $false 113 | } 114 | 115 | 116 | #Determine if the device is included in the policy. 117 | $foundInPolicy = $false 118 | foreach ($assignment in $Assignments) 119 | { 120 | $target = $assignment.target 121 | if (($target.'@odata.type' -eq '#microsoft.graph.groupAssignmentTarget') -and $aadDeviceGroups.ContainsKey($target.groupId)) { 122 | Write-Verbose "Processing include target $($target.groupId)" 123 | #If a filter was found, test to see if the device should be included in the policy. 124 | if ($null -ne $target.deviceAndAppManagementAssignmentFilterId){ 125 | if (Test-AssignmentFilter -FilterId $target.deviceAndAppManagementAssignmentFilterId -FilterType $target.deviceAndAppManagementAssignmentFilterType -DeviceId $intuneDeviceId ){ 126 | Write-Verbose "$($DeviceId) matched the filter" 127 | $foundInPolicy = $true 128 | } 129 | } 130 | #If no filter was found. 131 | else{ 132 | $foundInPolicy = $true 133 | break 134 | } 135 | 136 | } 137 | } 138 | return $foundInPolicy 139 | } 140 | 141 | 142 | <# 143 | .SYNOPSIS 144 | Determine if Device is in a given WUfB Deployment Service Audience. 145 | 146 | .DESCRIPTION 147 | Each WUfb Deployment Service deployment has an audience which represents a group of devices the deployment is targetting. These groups are distinct from all other grouping concepts including AzureAD. There is no device-centric call within the WUfB DS to list what audiences a device is on. This function then, does some very brute and inefficient stuff to figure out if or if not a given device is in a given audience. 148 | 149 | .PARAMETER AudienceId 150 | The Audience ID of a given deployment. 151 | 152 | .PARAMETER DeviceId 153 | The AzureAD Device ID of the device you wish to test. 154 | 155 | .EXAMPLE 156 | Test-DeviceInAudience -AudienceId 5434e3fc-5d8d-484a-kc32-908687279415 -DeviceId a0e35867-744b-472r-9a90-df9c7d249623 157 | 158 | .NOTES 159 | This is all horrible ... so horrible ... but I know of no other way. 160 | I am. 161 | Sorry. 162 | So. 163 | So. 164 | Sorry. 165 | #> 166 | function Test-DeviceInAudience { 167 | [CmdletBinding()] 168 | param ( 169 | [Parameter(Mandatory = $true)] 170 | [string]$AudienceId, 171 | 172 | [Parameter(Mandatory = $true)] 173 | [string]$DeviceId 174 | ) 175 | 176 | # Check exclusion list 177 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/deploymentAudiences/$AudienceId/exclusions" 178 | $exclusionResponse = Invoke-MgGraphRequest -Uri $uri 179 | 180 | foreach ($exclusion in $exclusionResponse.value) { 181 | if ($exclusion.'@odata.type' -eq '#microsoft.graph.windowsUpdates.updatableAssetGroup') { 182 | $groupMembersUri = "https://graph.microsoft.com/beta/admin/windows/updates/updatableAssets/$($exclusion.id)/microsoft.graph.windowsUpdates.updatableAssetGroup/members" 183 | $groupMembersResponse = Invoke-MgGraphRequest -Uri $groupMembersUri 184 | 185 | foreach ($groupMember in $groupMembersResponse.value) { 186 | if (($groupMember.id -eq $DeviceId)) { 187 | return $false 188 | } 189 | } 190 | } 191 | elseif ($exclusion.id -eq $DeviceId) { 192 | return $false 193 | } 194 | } 195 | 196 | # Check inclusion in the audience 197 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/deploymentAudiences/$AudienceId/members" 198 | $audienceMemberResponse = Invoke-MgGraphRequest -Uri $uri 199 | 200 | foreach ($audienceMember in $audienceMemberResponse.value) { 201 | if ($audienceMember.'@odata.type' -eq '#microsoft.graph.windowsUpdates.updatableAssetGroup') { 202 | $groupMembersUri = "https://graph.microsoft.com/beta/admin/windows/updates/updatableAssets/$($audienceMember.id)/microsoft.graph.windowsUpdates.updatableAssetGroup/members" 203 | $groupMembersResponse = Invoke-MgGraphRequest -Uri $groupMembersUri 204 | 205 | foreach ($groupMember in $groupMembersResponse.value) { 206 | if (($groupMember.id -eq $DeviceId)) { 207 | return $true 208 | } 209 | } 210 | } 211 | elseif ($audienceMember.id -eq $DeviceId) { 212 | return $true; 213 | } 214 | } 215 | 216 | return $false 217 | } 218 | 219 | 220 | Clear-Host 221 | $ProgressPreference = 'SilentlyContinue' 222 | 223 | # Install Microsoft.Graph PowerShell module if not already installed 224 | if (-not (Get-Module -Name Microsoft.Graph -ListAvailable)) { 225 | Install-Module -Name Microsoft.Graph -Scope CurrentUser -Force -AllowClobber 226 | } 227 | 228 | # Import the Microsoft.Graph module 229 | Import-Module Microsoft.Graph.Authentication, Microsoft.Graph.Identity.DirectoryManagement -Force 230 | 231 | # Connect to Graph is not already connected. 232 | if(-not (Get-MgContext -ErrorAction SilentlyContinue)) 233 | { 234 | #Select-MgProfile -Name "beta" 235 | Connect-MgGraph -NoWelcome -Scopes "WindowsUpdates.ReadWrite.All","User.Read.All","Device.Read.All","Group.Read.All", "Organization.Read.All", "Directory.Read.All", "Organization.ReadWrite.All", "Directory.ReadWrite.All", "DeviceManagementManagedDevices.Read.All", "DeviceManagementConfiguration.Read.All" 236 | } 237 | 238 | # Prompt for computer name 239 | $computerName = Read-Host -Prompt "Enter the name of the computer" 240 | 241 | # Query Intune for device information 242 | $aadDevice = Get-MgDevice -Filter "displayName eq '$computerName'" 243 | 244 | if (!$aadDevice) { 245 | Write-Output "Device with name '$computerName' not found." 246 | exit 247 | } 248 | 249 | Write-Output "Computer Name: $($aadDevice.displayName)" 250 | 251 | $aadObjectId = $aadDevice.id 252 | $aadDeviceId = $aadDevice.DeviceId 253 | $osVersion = $aadDevice.operatingSystemVersion 254 | Write-Output "Object ID: $aadObjectId" 255 | Write-Output "Device ID: $aadDeviceId" 256 | 257 | $uri = "https://graph.microsoft.com/beta/deviceManagement/manageddevices?filter=azureADDeviceId eq '$aadDeviceId'" 258 | Write-Debug "Calling $uri" 259 | $response = Invoke-MgGraphRequest -Uri $uri 260 | $intuneDevice = $response.Value | Select-Object -First 1 261 | $intuneDeviceId = $intuneDevice.Id 262 | Write-Output "Intune ID: $intuneDeviceId" 263 | 264 | # Get list of AAD groups the device is in 265 | $aadDeviceGroups = @{} 266 | $uri = "https://graph.microsoft.com/beta/devices/$aadObjectId/transitiveMemberOf" 267 | Write-Debug "Calling $uri" 268 | $response = Invoke-MgGraphRequest -Uri $uri 269 | foreach ( $group in $response.value ){ 270 | if (!$aadDeviceGroups.ContainsKey($group.id)){ 271 | $aadDeviceGroups.Add($group.id,$group.displayName) 272 | } 273 | } 274 | $uri = "https://graph.microsoft.com/beta/devices/$aadObjectId/memberOf" 275 | Write-Debug "Calling $uri" 276 | $response = Invoke-MgGraphRequest -Uri $uri 277 | foreach ( $group in $response.value ){ 278 | if (!$aadDeviceGroups.ContainsKey($group.id)){ 279 | $aadDeviceGroups.Add($group.id,$group.displayName) 280 | } 281 | } 282 | Write-Host "AAD Device Groups:" 283 | if ($aadDeviceGroups.Count -eq 0) 284 | {Write-Host "`tNo device groups found."} 285 | else{ 286 | foreach ($aadGroup in $aadDeviceGroups.GetEnumerator()) 287 | {Write-Host "`t$($aadGroup.Value) ($($aadGroup.Key))"} 288 | } 289 | 290 | #Get the Primary User for the device 291 | $uri = "https://graph.microsoft.com/beta/deviceManagement/manageddevices('$intuneDeviceId')/users" 292 | Write-Debug "Calling $uri" 293 | $response = Invoke-MgGraphRequest -Uri $uri 294 | $primaryUser = $response.value | Select-Object -First 1 295 | $primaryUserId = $primaryUser.id 296 | Write-Host "Primary User: $($primaryUser.displayName) ($primaryUserId)" 297 | 298 | $aadUserGroups = @{} 299 | $uri = "https://graph.microsoft.com/beta/users/$primaryUserId/memberOf" 300 | Write-Debug "Calling $uri" 301 | $response = Invoke-MgGraphRequest -Uri $uri 302 | foreach ( $group in $response.value ){ 303 | if (!$aadUserGroups.ContainsKey($group.id)){ 304 | $aadUserGroups.Add($group.id,$group.displayName) 305 | } 306 | } 307 | Write-Host "AAD User Groups:" 308 | if ($aadUserGroups.Count -eq 0) 309 | {Write-Host "`tNo user groups found."} 310 | else{ 311 | foreach ($aadGroup in $aadUserGroups.GetEnumerator()) 312 | {Write-Host "`t$($aadGroup.Value) ($($aadGroup.Key))"} 313 | } 314 | 315 | #Confirm Tenant is Enrolled 316 | if ((Get-MgSubscribedSKU | Where-Object { $_.ServicePlans.ServicePlanName -eq "WINDOWSUPDATEFORBUSINESS_DEPLOYMENTSERVICE" }).Count -gt 0) 317 | {Write-Output "`nTenant: Enrolled in Deployment Service "} 318 | else 319 | {Write-Output "`nTenant: Not enrolled in Deployment Service "} 320 | 321 | #Confirm that Device is enrolled 322 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/updatableAssets/$aadDeviceId" 323 | Write-Debug "Calling $uri" 324 | $response = Invoke-MgGraphRequest -Uri $uri -SkipHttpErrorCheck 325 | 326 | if (($null -eq $response) -or ($response.error.code -eq 'NotFound')) 327 | {Write-Output "Device Id: Not enrolled in Deployment Service by Device Id. "} 328 | else 329 | { 330 | Write-Output "Device: Enrolled in Deployment Service by Device Id." 331 | 332 | # List any enrollment errors. 333 | $enrollmentErrors = $response.errors | ForEach-Object { $_.reason } 334 | if ($enrollmentErrors.Count -eq 0) { 335 | Write-Output "`tNo enrollment errors." 336 | } 337 | else { 338 | foreach ($enrollmentError in $enrollmentErrors){ 339 | Write-Output "`tEnrollment error: $enrollmentError" 340 | } 341 | } 342 | 343 | # List the update categories the device is enrolled in 344 | if ($response.enrollment.Keys.Count -eq 0) { 345 | Write-Output "`tNot enrolled in any update categories." 346 | } 347 | else { 348 | Write-Output "`tEnrolled for:" 349 | foreach ($key in $response.enrollment.Keys){ 350 | Write-Output "`t`t$key : $($response.enrollment[$key].enrollmentState) ($($($response.enrollment[$key].lastModifiedDateTime?.ToString("dddd, MMMM dd, yyyy"))))" 351 | } 352 | } 353 | } 354 | 355 | #Get the latest update installed on device. 356 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/catalog/entries?`$filter=microsoft.graph.windowsUpdates.qualityUpdateCatalogEntry/productRevisions/any(c:c/id eq '$osVersion')&`$expand=microsoft.graph.windowsUpdates.qualityUpdateCatalogEntry/productRevisions" 357 | Write-Verbose "Calling $uri" 358 | $response = Invoke-MgGraphRequest -Uri $uri 359 | 360 | if ($null -eq $response){ 361 | Write-Output "`nOperating System Version: $osVersion" 362 | Write-Output "`tFailed to find the installed patch." 363 | } 364 | else{ 365 | # Get the OS version and latest update. 366 | foreach($productRevision in $response.value.productRevisions){ 367 | if ($productRevision.id -eq $osVersion){ 368 | $productName = $productRevision.product 369 | $productVersion = $productRevision.version 370 | break 371 | } 372 | } 373 | Write-Output "`nOperating System Version: $productName $productVersion ($osVersion)" 374 | Write-Output "Last Installed Update: $($response.value.catalogName)" 375 | Write-Output "`t`tUpdate Id: $($response.value.id)" 376 | Write-Output "`t`tRelease Date: $($response.value.releaseDateTime.ToString("dddd, MMMM dd, yyyy"))" 377 | Write-Output "`t`tClassification: $($response.value.qualityUpdateClassification)" 378 | Write-Output "`t`tType: $($response.value.qualityUpdateCadence)" 379 | 380 | #Get the latest update for the device 381 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/catalog/entries?`$filter=microsoft.graph.windowsUpdates.qualityUpdateCatalogEntry/qualityUpdateClassification eq 'Security' and microsoft.graph.windowsUpdates.qualityUpdateCatalogEntry/productRevisions/any(c:c/version eq '$($productVersion)' and c/product eq '$($productName)')&`$expand=microsoft.graph.windowsUpdates.qualityUpdateCatalogEntry/productRevisions&`$orderby=releaseDateTime desc&`$top=1" 382 | Write-Debug "Calling $uri" 383 | $response = Invoke-MgGraphRequest -Uri $uri 384 | if ($null -ne $response){ 385 | Write-Output "Latest Security Update: $($response.value.catalogName)" 386 | Write-Output "`t`tUpdate Id: $($response.value.id)" 387 | Write-Output "`t`tRelease Date: $($response.value.releaseDateTime.ToString("dddd, MMMM dd, yyyy"))" 388 | Write-Output "`t`tClassification: $($response.value.qualityUpdateClassification)" 389 | Write-Output "`t`tType: $($response.value.qualityUpdateCadence)" 390 | } 391 | } 392 | 393 | 394 | 395 | #Get the legacy WUfB Deployments. The DS is migrating to policies but currently (April 2024) it's only for drivers. 396 | $wufbLegacyDeployments = @{} 397 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/deployments" 398 | Write-Debug "Calling $uri" 399 | $response = Invoke-MgGraphRequest -Uri $uri 400 | Write-Verbose "Found a total of $($response.value.count) WUfB DS policies" 401 | foreach ( $wufbLegacyDeployment in $response.value ){ 402 | 403 | #Skip old policies that are archived and not in effect 404 | if ($wufbLegacyDeployment.state.effectiveValue -eq 'archived') 405 | {continue} 406 | 407 | if (Test-DeviceInAudience -AudienceId $wufbLegacyDeployment.audience.id -DeviceId $aadDeviceId) 408 | {$wufbLegacyDeployments.Add($wufbLegacyDeployment.id, $wufbLegacyDeployment) } 409 | 410 | } 411 | Write-Verbose "Found a filtered set of $($wufbLegacyDeployments.count) policies that apply to this device." 412 | 413 | #Calculate the next Patch Tuesday 414 | $baseDate = ( Get-Date -Day 12 ).Date 415 | $patchTuesday = $baseDate.AddDays( 2 - [int]$baseDate.DayOfWeek ) 416 | If ( (Get-Date) -lt $patchTuesday ) 417 | { 418 | $baseDate = $baseDate.AddMonths( 1 ) 419 | $patchTuesday = $baseDate.AddDays( 2 - [int]$baseDate.DayOfWeek ) 420 | } 421 | Write-Debug "Patch Tuesday: $patchTuesday" 422 | 423 | # Get the Intune Update Rings 424 | $intuneUpdateRings = @{} 425 | $uri = 'https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations?$filter=isof(%27microsoft.graph.windowsUpdateForBusinessConfiguration%27)&$expand=assignments' 426 | Write-Debug "Calling $uri" 427 | $response = Invoke-MgGraphRequest -Uri $uri 428 | foreach ( $intuneUpdateRing in $response.value ){ 429 | #Add the Intune Update Rings if the device is targeted 430 | Write-Verbose "Testing Intune Update Ring $($intuneUpdateRing.displayName)($($intuneUpdateRing.id))" 431 | if (!$intuneUpdateRings.ContainsKey($intuneUpdateRing.Id) -and (Test-Assignment -Assignments $intuneUpdateRing.assignments -DeviceId $intuneDeviceId )){ 432 | $intuneUpdateRings.Add($intuneUpdateRing.Id, $intuneUpdateRing) 433 | } 434 | } 435 | 436 | Write-Host "`nIntune Update Rings:" 437 | if ($intuneUpdateRings.Count -eq 0) 438 | {Write-Host "`tNo Intune update rings found."} 439 | else{ 440 | foreach ($intuneUpdateRing in $intuneUpdateRings.GetEnumerator()) 441 | { 442 | Write-Host "`t$($intuneUpdateRing.Value.displayName) ($($intuneUpdateRing.Key))" 443 | Write-Host "`t`tQuality Deferal: $($intuneUpdateRing.value.qualityUpdatesDeferralPeriodInDays) days ($($patchTuesday.AddDays($intuneUpdateRing.value.qualityUpdatesDeferralPeriodInDays).ToString("dddd MMMM dd, yyyy")))" 444 | Write-Host "`t`tQuality Deadline: $($intuneUpdateRing.value.deadlineForFeatureUpdatesInDays) days ($($patchTuesday.AddDays($intuneUpdateRing.value.qualityUpdatesDeferralPeriodInDays + $intuneUpdateRing.value.deadlineForQualityUpdatesInDays).ToString("dddd MMMM dd, yyyy")))" 445 | Write-Host "`t`tQuality Grace Period: $($intuneUpdateRing.value.deadlineGracePeriodInDays) days" 446 | if ($intuneUpdateRing.value.qualityUpdatesPaused -eq $true) 447 | { 448 | $dateTime = [datetime]::Parse($intuneUpdateRing.value.qualityUpdatesPauseExpiryDateTime) 449 | Write-Host "`t`t`tQuality Paused until: $($dateTime.ToString("dddd, MMMM dd, yyyy"))" 450 | } 451 | 452 | 453 | Write-Host "`t`tFeature Deferal: $($intuneUpdateRing.value.featureUpdatesDeferralPeriodInDays)" 454 | if ($intuneUpdateRing.value.featureUpdatesPaused -eq $true) 455 | { 456 | $dateTime = [datetime]::Parse($intuneUpdateRing.value.featureUpdatesPauseExpiryDateTime) 457 | Write-Host "`t`t`tFeature Paused until: $($dateTime.ToString("dddd, MMMM dd, yyyy"))" 458 | } 459 | Write-Host "`t`tDriver Excluded: $($intuneUpdateRing.value.driversExcluded)" 460 | Write-Host "`t`tAllow Win 11: $($intuneUpdateRing.value.allowWindows11Upgrade)" 461 | 462 | } 463 | } 464 | 465 | # Get the Intune Feature Update policies 466 | $intuneFeatureUpdates = @{} 467 | $uri = 'https://graph.microsoft.com/beta/deviceManagement/windowsFeatureUpdateProfiles?$expand=assignments' 468 | Write-Debug "Calling $uri" 469 | $response = Invoke-MgGraphRequest -Uri $uri 470 | foreach ( $intuneFeatureUpdate in $response.value ){ 471 | 472 | #Add the Intune Feature Update Policies if the device is targeted 473 | Write-Verbose "Testing Feature Update Policy $($intuneFeatureUpdate.displayName)($($intuneFeatureUpdate.id))" 474 | if (!$intuneFeatureUpdates.ContainsKey($intuneFeatureUpdate.Id) -and (Test-Assignment -Assignments $intuneFeatureUpdate.assignments -DeviceId $intuneDeviceId)){ 475 | $intuneFeatureUpdates.Add($intuneFeatureUpdate.Id, $intuneFeatureUpdate) 476 | } 477 | } 478 | 479 | Write-Host "`nIntune Feature Update Policies" 480 | if ($intuneFeatureUpdates.Count -eq 0) 481 | {Write-Host "`tNo Intune feature update policies found."} 482 | else{ 483 | foreach ($intuneFeatureUpdate in $intuneFeatureUpdates.GetEnumerator()) 484 | { 485 | Write-Host "`t$($intuneFeatureUpdate.Value.displayName) ($($intuneFeatureUpdate.Key))" 486 | Write-Host "`t`tFeature Update: $($intuneFeatureUpdate.value.featureUpdateVersion)" 487 | Write-Host "`t`tWin 10 Fallback: $($intuneFeatureUpdate.value.installLatestWindows10OnWindows11IneligibleDevice)" 488 | } 489 | } 490 | 491 | # Get the Quality Expedite Policies 492 | $intuneExpeditePolicies = @{} 493 | $uri = 'https://graph.microsoft.com/beta/deviceManagement/windowsQualityUpdateProfiles?$expand=assignments' 494 | Write-Debug "Calling $uri" 495 | $response = Invoke-MgGraphRequest -Uri $uri 496 | foreach ( $intuneExpeditePolicy in $response.value ){ 497 | 498 | #Add the Intune Expedite policy if the device is targeted 499 | Write-Verbose "Testing Feature Update Policy $($intuneExpeditePolicy.displayName)($($intuneExpeditePolicy.id))" 500 | if (!$intuneExpeditePolicies.ContainsKey($intuneExpeditePolicy.Id) -and (Test-Assignment -Assignments $intuneExpeditePolicy.assignments -DeviceId $intuneDeviceId )){ 501 | $intuneExpeditePolicies.Add($intuneExpeditePolicy.Id, $intuneExpeditePolicy) 502 | } 503 | } 504 | 505 | Write-Host "`nIntune Expedite Policies" 506 | if ($intuneExpeditePolicies.Count -eq 0) 507 | {Write-Host "`tNo Intune expedite policies found."} 508 | else{ 509 | foreach ($intuneExpeditePolicy in $intuneExpeditePolicies.GetEnumerator()) 510 | { 511 | # Get the full policy details 512 | $uri = "https://graph.microsoft.com/beta/deviceManagement/windowsQualityUpdateProfiles/$($intuneExpeditePolicy.Key)" 513 | Write-Debug "Calling $uri" 514 | $response = Invoke-MgGraphRequest -Uri $uri 515 | 516 | Write-Host "`t$($response.displayName) ($($response.Id))" 517 | Write-Host "`t`tUpdate: $($response.deployableContentDisplayName)" 518 | Write-Host "`t`tReleased On: $(($response.expeditedUpdateSettings.qualityUpdateRelease).ToString("dddd, MMMM dd, yyyy"))" 519 | Write-Host "`t`tDeployed On: $(($response.createdDateTime).ToString("dddd, MMMM dd, yyyy"))" 520 | Write-Host "`t`tDays Until Forced Reboot: $($response.expeditedUpdateSettings.daysUntilForcedReboot)" 521 | } 522 | } 523 | 524 | #Find Expediated Quality Updates 525 | $expediteReadinessDeployment = $null 526 | $wufbExpediteDeployments = @{} 527 | foreach ($wufbLegacyDeployment in $wufbLegacyDeployments.GetEnumerator()) 528 | { 529 | #Filter for Expedited deployments 530 | if ($wufbLegacyDeployment.Value.settings.expedite.isExpedited -eq $true) 531 | { 532 | # Separate Expedite deployments from Epedite Readiness deployments. 533 | if ($wufbLegacyDeployment.Value.settings.expedite.isReadinessTest -eq $true) 534 | { 535 | if ($expediteReadinessDeployment){ 536 | Write-Warning "This device has two Expedite Readiness policies '$($wufbLegacyDeployment.Value.id)' and '$($expediteReadinessDeployment.id)' which is weird." 537 | } 538 | $expediteReadinessDeployment = $wufbLegacyDeployment.Value 539 | continue 540 | } 541 | else{ 542 | $wufbExpediteDeployments.Add($wufbLegacyDeployment.Key, $wufbLegacyDeployment.Value) 543 | } 544 | } 545 | } 546 | 547 | Write-Host "WUfB DS Expedite Deployments" 548 | if ($wufbExpediteDeployments.Count -eq 0) 549 | {Write-Host "`tNo WUfB expedite policies found."} 550 | else{ 551 | foreach ($wufbExpediteDeployment in $wufbExpediteDeployments.GetEnumerator()) 552 | { 553 | 554 | Write-Host "`tDeployment $($wufbExpediteDeployment.Key)" 555 | if ($wufbExpediteDeployment.Value.content.'@odata.type' -eq '#microsoft.graph.windowsUpdates.catalogContent' -and $wufbExpediteDeployment.Value.content.catalogEntry.'@odata.type' -eq '#microsoft.graph.windowsUpdates.qualityUpdateCatalogEntry'){ 556 | #The DS doesn't expedite individual updates so lookup the display name in Intune based on the DS release date. 557 | $uri = "https://graph.microsoft.com/beta/deviceManagement/windowsUpdateCatalogItems/microsoft.graph.windowsQualityUpdateCatalogItem?filter=releaseDateTime eq $($wufbExpediteDeployment.Value.content.catalogEntry.releaseDateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffK"))" 558 | Write-Debug "Calling $uri" 559 | $response = Invoke-MgGraphRequest -Uri $uri 560 | 561 | if ($response.value.Count -eq 0){ 562 | Write-Host "`t`tUpdate: Unkonwn Quality Update" 563 | } 564 | else { 565 | Write-Host "`t`tUpdate: $($response.value.displayName)" 566 | } 567 | } 568 | Write-Host "`t`tReleased On: $(($wufbExpediteDeployment.Value.content.catalogEntry.releaseDateTime).ToString("dddd, MMMM dd, yyyy"))" 569 | Write-Host "`t`tDeployed On: $(($wufbExpediteDeployment.Value.createdDateTime).ToString("dddd, MMMM dd, yyyy"))" 570 | Write-Host "`t`tDays Until Forced Reboot: $($wufbExpediteDeployment.Value.settings.userExperience.daysUntilForcedReboot) days" 571 | } 572 | } 573 | 574 | # Handle Expedite Readiness deployment 575 | if (!$expediteReadinessDeployment){ 576 | Write-Host "`tNo WUfB DS Expedite Readiness Deployment found." 577 | } 578 | else{ 579 | Write-Host "`tWUfB DS Expedite Readiness Deployment found ($($expediteReadinessDeployment.id))." 580 | } 581 | 582 | # Get the Intune Driver Policies 583 | $intuneDriverPolicies = @{} 584 | $uri = 'https://graph.microsoft.com/beta/deviceManagement/windowsDriverUpdateProfiles?$expand=assignments' 585 | Write-Debug "Calling $uri" 586 | $response = Invoke-MgGraphRequest -Uri $uri 587 | foreach ( $intuneDriverPolicy in $response.value ){ 588 | 589 | $foundInPolicy = $false 590 | foreach ($target in $intuneDriverPolicy.assignments.target) 591 | { 592 | if (($target.'@odata.type' -eq '#microsoft.graph.exclusionGroupAssignmentTarget') -and $aadDeviceGroups.ContainsKey($target.groupId)) { 593 | $foundInPolicy = $false 594 | break 595 | } 596 | elseif (($target.'@odata.type' -eq '#microsoft.graph.groupAssignmentTarget') -and $aadDeviceGroups.ContainsKey($target.groupId)) { 597 | $foundInPolicy = $true 598 | } 599 | 600 | if ($foundInPolicy -and !$intuneDriverPolicies.ContainsKey($intuneDriverPolicy.Id)){ 601 | $intuneDriverPolicies.Add($intuneDriverPolicy.Id, $intuneDriverPolicy) 602 | } 603 | 604 | } 605 | } 606 | 607 | Write-Host "`nIntune Driver Update Policies" 608 | if ($intuneDriverPolicies.Count -eq 0) 609 | {Write-Host "`tNo WUfB driver update policies found."} 610 | else{ 611 | foreach ($intuneDriverPolicy in $intuneDriverPolicies.GetEnumerator()) 612 | { 613 | Write-Host "`t$($intuneDriverPolicy.value.displayName) ($($intuneDriverPolicy.Key))" 614 | 615 | Write-Host "`t`tApproval: $($intuneDriverPolicy.value.approvalType)" 616 | if ($null -ne $intuneDriverPolicy.value.deploymentDeferralInDays){ 617 | Write-Host "`t`tDeferral: $($intuneDriverPolicy.value.deploymentDeferralInDays) days" 618 | } 619 | 620 | #Get the driver inventory. 621 | $uri = "https://graph.microsoft.com/beta/deviceManagement/windowsDriverUpdateProfiles/$($intuneDriverPolicy.Key)/driverInventories" 622 | Write-Debug "Calling $uri" 623 | $response = Invoke-MgGraphRequest -Uri $uri 624 | 625 | if ($response.value.Count -eq 0){ 626 | Write-Host "`t`tNo Drivers Found" 627 | } 628 | else{ 629 | Write-Host "`t`tDeployed Drivers:" 630 | foreach ($driver in $response.value){ 631 | if ($driver.approvalStatus -eq 'approved'){ 632 | Write-Host "`t`t`t$($driver.name) ($($driver.version)): $([datetime]::Parse($driver.deployDateTime).ToString("dddd, MMMM dd, yyyy"))" 633 | } 634 | } 635 | } 636 | } 637 | } 638 | 639 | # Get the WUfb Deployment Service Driver Policies 640 | Write-Host "WUfB DS Driver Deployments:" 641 | $uri = 'https://graph.microsoft.com/beta/admin/windows/updates/updatePolicies' 642 | Write-Debug "Calling $uri" 643 | $response = Invoke-MgGraphRequest -Uri $uri 644 | foreach ( $wufbDsDriverPolicy in $response.value ){ 645 | 646 | Write-Verbose "Processing Policy $($wufbDsDriverPolicy.id)" 647 | 648 | if (!$wufbDsDriverPolicy.autoEnrollmentUpdateCategories.Contains("driver")) 649 | { 650 | Write-Warning "Policy does not contain a driver policy. API changes might have occurred; please contact author." 651 | continue 652 | } 653 | 654 | # Make sure device is not in exclusion list 655 | if($wufbDsDriverPolicy.audience.id) { 656 | Write-Verbose "Processing Policy Audience Member Exclusion $($wufbDsDriverPolicy.audience.id)" 657 | $foundExclusion = $false 658 | $uri = "https://graph.microsoft.com/beta/admin//windows/updates/deploymentAudiences/$($wufbDsDriverPolicy.audience.id)/exclusions" 659 | $audienceMemberResponse = Invoke-MgGraphRequest -Uri $uri 660 | foreach ($audienceMember in $audienceMemberResponse.value){ 661 | Write-Verbose "Processing Policy Audience Member Exclusion $($audienceMember.id)" 662 | if ($audienceMember.'@odata.type' -eq '#microsoft.graph.windowsUpdates.updatableAssetGroup'){ 663 | Write-Verbose "Processing Policy Audience Member Exclusion Updatable Group $($audienceMember.id)" 664 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/updatableAssets/$($audienceMember.id)/microsoft.graph.windowsUpdates.updatableAssetGroup/members" 665 | Write-Debug "Calling $uri" 666 | $groupMemberResponse = Invoke-MgGraphRequest -Uri $uri 667 | foreach ($groupMember in $groupMemberResponse.value){ 668 | if (($groupMember.id -eq $aadObjectId) -or ($groupMember.id -eq $aadDeviceId)) { 669 | $foundExclusion = $true 670 | break 671 | } 672 | } 673 | } 674 | elseif (($audienceMember.id -eq $aadObjectId) -or ($audienceMember.id -eq $aadDeviceId)) { 675 | $foundExclusion = $true 676 | break 677 | } 678 | } 679 | #If an exclusion was found, skip this record 680 | if ($foundExclusion) { 681 | continue 682 | } 683 | 684 | # See if device is in the deployment audience. 685 | Write-Verbose "Processing Policy Audience Member Inclusion $($wufbDsDriverPolicy.audience.id)" 686 | $foundInPolicy = $false 687 | $uri = "https://graph.microsoft.com/beta/admin//windows/updates/deploymentAudiences/$($wufbDsDriverPolicy.audience.id)/members" 688 | Write-Debug "Calling $uri" 689 | $audienceMemberResponse = Invoke-MgGraphRequest -Uri $uri 690 | foreach ($audienceMember in $audienceMemberResponse.value){ 691 | Write-Verbose "Processing Policy Audience Member Inclusion $($audienceMember.id)" 692 | if ($audienceMember.'@odata.type' -eq '#microsoft.graph.windowsUpdates.updatableAssetGroup'){ 693 | Write-Verbose "Processing Policy Audience Member InclusionUpdatable Group $($audienceMember.id)" 694 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/updatableAssets/$($audienceMember.id)/microsoft.graph.windowsUpdates.updatableAssetGroup/members" 695 | Write-Debug "Calling $uri" 696 | $groupMemberResponse = Invoke-MgGraphRequest -Uri $uri 697 | foreach ($groupMember in $groupMemberResponse.value){ 698 | if (($groupMember.id -eq $aadObjectId) -or ($groupMember.id -eq $aadDeviceId)) { 699 | $foundInPolicy = $true 700 | break 701 | } 702 | } 703 | } 704 | elseif (($audienceMember.id -eq $aadObjectId) -or ($audienceMember.id -eq $aadDeviceId)) { 705 | $foundInPolicy = $true 706 | break 707 | } 708 | } 709 | } 710 | 711 | if ($foundInPolicy){ 712 | Write-Host "`tPolicy $($wufbDsDriverPolicy.id)" 713 | $uri = "https://graph.microsoft.com/beta/admin/windows/updates/updatePolicies/$($wufbDsDriverPolicy.id)/complianceChanges" 714 | Write-Debug "Calling $uri" 715 | $driverDeploymentResponse = Invoke-MgGraphRequest -Uri $uri 716 | foreach ( $wufbDsDriverDeployment in $driverDeploymentResponse.value ){ 717 | if ((!$wufbDsDriverDeployment.isRevoked) -and ( $wufbDsDriverDeployment.content.catalogEntry.'@odata.type') -eq '#microsoft.graph.windowsUpdates.driverUpdateCatalogEntry' ){ 718 | Write-Host "`t`t`t$($wufbDsDriverDeployment.content.catalogentry.displayname) ($($wufbDsDriverDeployment.content.catalogentry.version)): $([datetime]::Parse($wufbDsDriverDeployment.deploymentSettings.schedule.startDateTime).ToString("dddd, MMMM dd, yyyy"))" 719 | } 720 | 721 | } 722 | } 723 | 724 | } -------------------------------------------------------------------------------- /Invoke-DGAAutomaticDeploymentRules.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bryandam/SoftwareUpdateScripts/c4f5032b420d19adcc8f659ab0809acb480fb7d0/Invoke-DGAAutomaticDeploymentRules.ps1 -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/License.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-3rdPartyUpdates.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Enter your synopsis here. 19 | .DESCRIPTION 20 | Provide a more full description here. 21 | .NOTES 22 | Written By: Damien Solodow @dsolodow 23 | Version 1.0: 04/09/2020 24 | #> 25 | 26 | $3rdParties = @('Patch My PC', 'Lenovo') 27 | Function Invoke-SelectUpdatesPlugin { 28 | 29 | $DeclineUpdates = @{} 30 | If (!($3rdParties)) { 31 | Return $DeclineUpdates 32 | } 33 | 34 | $SupersededUpdates = ($ActiveUpdates | Where-Object {$_.IsSuperseded -eq $true -and $_.UpdateClassificationTitle -ne 'Definition Updates' -and $_.CompanyTitles -ne 'Microsoft'}) 35 | 36 | #Loop through the updates. 37 | ForEach ($Update in $SupersededUpdates) { 38 | foreach ($Vendor in $3rdParties) { 39 | If ($Update.CompanyTitles -match $Vendor) { 40 | #Verify that the updates aren't being excluded. 41 | If (!(Test-Exclusions $Update)) { 42 | 43 | #Enter all your fun logic to add updates to the hashtable. 44 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "3rd Party Updates: Superceded") 45 | } 46 | } 47 | } 48 | } 49 | 50 | Return $DeclineUpdates 51 | } 52 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-ByConfigMgrCustomSeverityOfLow.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | ################################################################################ 17 | #.SYNOPSIS 18 | # Decline-ByConfigMgrCustomSeverityOfLow.ps1 19 | # A helper script function to identify Software Updates in ConfigMgr/SCCM with 20 | # a Custom Severity set to Low (2) 21 | # for declining in WSUS and expiring in ConfigMgr/SCCM 22 | #.LINK 23 | # Reference Invoke-DGASoftwareUpdateMaintenance.ps1 24 | #.NOTES 25 | # This script is invoked by Invoke-DGASoftwareUpdateMaintenance.ps1 and not run independently 26 | # 27 | # ========== Keywords ========== 28 | # Keywords: WSUS SUP SCCM ConfigMgr Decline Expire Update Maintenance Superseded 29 | # ========== Change Log History ========== 30 | # - 2020/08/13 by Chad.Simmons@CatapultSystems.com - Created 31 | # - 2020/08/13 by Chad@ChadsTech.net - Created 32 | # === To Do / Proposed Changes === 33 | # - TODO: None 34 | ################################################################################ 35 | 36 | Function Invoke-SelectUpdatesPlugin { 37 | $PluginName = 'Decline-ByConfigMgrCustomSeverityOfLow' 38 | $CustomSeverityName = 'Low' 39 | $DeclineUpdates = @{} 40 | Add-TextToCMLog $LogFile "Discovering Updates in ConfigMgr" $PluginName 1 41 | $ConfigMgrUpdatesCustomSeverityLow = @(Get-CMSoftwareUpdate -Fast -IsExpired $false | Where-Object { $_.CustomSeverityName -eq $CustomSeverityName } | Select-Object CI_UniqueID).CI_UniqueID #-IsDeployed $false { $_.CustomSeverity -eq 2 } 42 | Add-TextToCMLog $LogFile "$($ConfigMgrUpdatesCustomSeverityLow.count) Updates discovered in ConfigMgr with a Custom Severity of [$CustomSeverityName]" $PluginName 1 43 | $UpdatesMatchingConfigMgr = $ActiveUpdates | Where-Object { $_.Id.UpdateId -in $ConfigMgrUpdatesCustomSeverityLow } 44 | Add-TextToCMLog $LogFile "$($UpdatesMatchingConfigMgr.count) Updates in WSUS match an Update in ConfigMgr with a Custom Severity of [$CustomSeverityName]" $PluginName 1 45 | #Loop through the updates and decline any that match the version. 46 | ForEach ($Update in $UpdatesMatchingConfigMgr) { 47 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "ConfigMgr Custom Severity of $CustomSeverityName") 48 | } 49 | Return $DeclineUpdates 50 | } -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-ByConfigMgrFolder_To Decline.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | ################################################################################ 17 | #.SYNOPSIS 18 | # Decline-ByConfigMgrFolder_To Decline.ps1 19 | # A helper script function to identify Software Updates in ConfigMgr/SCCM 20 | # moved to a folder named "To Decline" 21 | # for declining in WSUS and expiring in ConfigMgr/SCCM 22 | #.LINK 23 | # Reference Invoke-DGASoftwareUpdateMaintenance.ps1 24 | #.NOTES 25 | # This script is invoked by Invoke-DGASoftwareUpdateMaintenance.ps1 and not run independently 26 | # 27 | # ========== Keywords ========== 28 | # Keywords: WSUS SUP SCCM ConfigMgr Decline Expire Update Maintenance Superseded 29 | # ========== Change Log History ========== 30 | # - 2020/08/13 by Chad.Simmons@CatapultSystems.com - Created 31 | # - 2020/08/13 by Chad@ChadsTech.net - Created 32 | # === To Do / Proposed Changes === 33 | # - TODO: None 34 | ################################################################################ 35 | 36 | Function Invoke-SelectUpdatesPlugin{ 37 | $PluginName = 'Decline-ByConfigMgrFolder' 38 | $FolderPath = 'To Decline' 39 | $DeclineUpdates = @{} 40 | Add-TextToCMLog $LogFile "Discovering Updates in ConfigMgr" $PluginName 1 41 | $ConfigMgrUpdatesInFolder = @(Get-CMSoftwareUpdate -Fast -IsExpired $false | Where-Object { $_.ObjectPath -eq "/$FolderPath" } | Select-Object CI_UniqueID).CI_UniqueID #-IsDeployed $false 42 | Add-TextToCMLog $LogFile "$($ConfigMgrUpdatesInFolder.count) Updates discovered in ConfigMgr in the folder [$FolderPath]" $PluginName 1 43 | $UpdatesMatchingConfigMgr = $ActiveUpdates | Where-Object { $_.Id.UpdateId -in $ConfigMgrUpdatesInFolder } 44 | Add-TextToCMLog $LogFile "$($UpdatesMatchingConfigMgr.count) Updates in WSUS match an Update in ConfigMgr in the folder [$FolderPath]" $PluginName 1 45 | #Loop through the updates and decline any that match the version. 46 | ForEach ($Update in $UpdatesMatchingConfigMgr) { 47 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "ConfigMgr Folder of [$FolderPath]") 48 | } 49 | Return $DeclineUpdates 50 | } -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Edge.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Declines unsupported Channels, and older versions of Edge 4 | .DESCRIPTION 5 | Declines unsupported Channels, and optionally older and superceded versions of Edge 6 | .NOTES 7 | Written By: Damien Solodow @dsolodow 8 | Version 1.0: 01/24/2020 9 | #> 10 | #Un-comment and add elements to this array for Channels you support. 11 | 12 | #$SupportedChannels = @("Microsoft Edge-Stable Channel", "Microsoft Edge-Beta Channel", "Microsoft Edge-Dev Channel") 13 | 14 | #Set this to $True to decline all but the latest version of each Channels or $False to ignore versions. 15 | $LatestVersionOnly = $False 16 | 17 | #If Microsoft decides to change their naming scheme you will need to update this variable to support the new scheme. 18 | $KnownChannels = @("Microsoft Edge-Stable Channel", "Microsoft Edge-Beta Channel", "Microsoft Edge-Dev Channel") 19 | Function Invoke-SelectUpdatesPlugin { 20 | 21 | 22 | $DeclineUpdates = @{} 23 | If (!$SupportedChannels) { 24 | Return $DeclineUpdates 25 | } 26 | $maxVersions = @{} 27 | $EdgeUpdates = ($ActiveUpdates | Where-Object {$_.ProductTitles.Contains('Microsoft Edge')}) 28 | 29 | #Loop through the updates and Channels and determine the highest version number per Channel. 30 | If ($LatestVersionOnly) { 31 | ForEach ($Update in $EdgeUpdates) { 32 | ForEach ($KnownChannel in $KnownChannels) { 33 | If ($Update.Title -match $KnownChannel) { 34 | If ($Update.Title -match "Version (\d+)") { 35 | If ($Matches[1] -gt $maxVersions[$KnownChannel]) { 36 | $maxVersions.Set_Item($KnownChannel, $Matches[1]) 37 | } 38 | } 39 | } 40 | } 41 | } 42 | } 43 | 44 | #Loop through the updates and decline the desired updates. 45 | ForEach ($Update in $EdgeUpdates) { 46 | ForEach ($KnownChannel in $KnownChannels) { 47 | 48 | #Verify that the update is a known Channel. 49 | If ($Update.Title -match $KnownChannel) { 50 | 51 | #Determine if the update is a supported version and what known Channel it is. 52 | $FoundSupportedVersion = $False 53 | $FoundChannel = "" 54 | ForEach ($SupportedChannel in $SupportedChannels) { 55 | If ($Update.Title -match $SupportedChannel) { 56 | $FoundSupportedVersion = $True 57 | $FoundChannel = $KnownChannel 58 | } 59 | } 60 | 61 | #Check for exclusions 62 | If (Test-Exclusions $Update) { 63 | #Do Nothing 64 | 65 | #If a supported version was found and we're only keeping the latest version. 66 | } ElseIf ($FoundSupportedVersion -and $LatestVersionOnly) { 67 | #Decline updates that are not the latest version. 68 | If ($Update.Title -notlike "*Version $($maxVersions[$KnownChannel])*") { 69 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Edge Updates: Version") 70 | } 71 | If ($Update.IsSuperseded -eq "True") { 72 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Edge Updates: Version") 73 | } 74 | #If a supported version was not found then decline it. 75 | } ElseIf (! $FoundSupportedVersion) { 76 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Edge Updates: Channel") 77 | } 78 | } #If a Known Channel 79 | } #ForEach Channel 80 | 81 | 82 | 83 | } #Edge Updates 84 | Return $DeclineUpdates 85 | } 86 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-NotApprovedUpdatesOnUpstreamWSUS.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline any update that is not approved on the upstream WSUS server. 19 | .DESCRIPTION 20 | If the current WSUS Server uses an upstream WSUS server, decline any update that is not approved on the SUP. 21 | .NOTES 22 | The account used to run the maintenance script (most likely the site server computer account) will need, at a minimum, the "WSUS Reporters" permissions to connect and retrieve the list of updates on the upstream WSUS Server. 23 | 24 | 2019-04-04 by Charles 25 | #> 26 | 27 | Function Invoke-SelectUpdatesPlugin{ 28 | $pluginComponent = "Decline-NotApprovedUpdatesOnUpstreamWSUS" 29 | 30 | $DeclinedUpdates = @{} 31 | 32 | Add-TextToCMLog $LogFile "Checking if WSUS server $WSUSFQDN is using an upstream WSUS." $pluginComponent 1 33 | $WSUSConfig = $WSUSServer.GetConfiguration() 34 | 35 | if($WSUSConfig.SyncFromMicrosoftUpdate -eq $false){ 36 | Try{ 37 | $UpstreamWSUSServer = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WSUSConfig.UpstreamWsusServerName, $WSUSConfig.UpstreamWsusServerUseSsl, $WSUSConfig.UpstreamWsusServerPortNumber) 38 | } Catch{ 39 | Add-TextToCMLog $LogFile "Failed to connect to the upstream WSUS server $($WSUSConfig.UpstreamWsusServerName) on port $($WSUSConfig.UpstreamWsusServerPortNumber) with$(If(!$($WSUSConfig.UpstreamWsusServerUseSsl)){"out"}) SSL." $pluginComponent 3 40 | Add-TextToCMLog $LogFile "Error: $($_.Exception.HResult)): $($_.Exception.Message)" $pluginComponent 3 41 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $pluginComponent 3 42 | $UpstreamWSUSServer = $null 43 | Set-Location $OriginalLocation 44 | Return 45 | } 46 | 47 | Add-TextToCMLog $LogFile "Retrieving all approved updates on Upstream WSUS Server `"$($WSUSConfig.UpstreamWsusServerName)`"." $pluginComponent 1 48 | $UpstreamApproved = $UpstreamWSUSServer.GetUpdates() | Where-Object {$_.IsApproved} 49 | Add-TextToCMLog $LogFile "Retrieved list of updates on Upstream WSUS Server." $pluginComponent 1 50 | $UpstreamApprovedIDs = $UpstreamApproved.Id.UpdateId.Guid 51 | 52 | foreach($update in $ActiveUpdates){ 53 | if($update.Id.UpdateId.Guid -notin $UpstreamApprovedIDs){ 54 | $DeclinedUpdates.Set_Item($update.Id.UpdateId,"Update is not approved on upstream WSUS Server.") 55 | } 56 | } 57 | }else{ 58 | Add-TextToCMLog $LogFile "WSUS server $WSUSFQDN is configured to sync with Microsoft, plugin is not applicable. Skipping plugin..." $pluginComponent 2 59 | } 60 | Return $DeclinedUpdates 61 | } 62 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Office365Editions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline updates for editions of Office 365 your organization does not support. 19 | .DESCRIPTION 20 | Decline updates for editions of Office 365 your organization does not support. If the LatestVersionOnly is left to its default value of True then for each edition only the latest version will be retained and all others declined. 21 | .NOTES 22 | You must un-comment the $SupportedEditions variable and add the editions your organization supports. 23 | 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. 24 | Written By: Bryan Dam 25 | Version 1.0: 10/28/17 26 | Version 2.0: 06/29/18 Fixed issue with selecting multiple editions. 27 | Version 3.0: 06/09/20 Make channels multi-line, add extra channels 28 | Version 4.0: 11/04/22 Update ProductTitles and KnownEditions to support Office 2021/2019 and name change 29 | #> 30 | #Un-comment and add elements to this array for editions you support. 31 | #Note: You must escape any parenthesis with the forward slash. Ex.: "Office 365 Client Update - Monthly Channel \(Targeted\) Version" 32 | #$SupportedEditions = @( 33 | # "Office 365 Client Update - Semi-annual Channel Version", 34 | # "Microsoft 365 Apps Update - Semi-Annual Enterprise Channel Version" 35 | #) 36 | 37 | #Set this to $True to decline all but the latest version of each editions or $False to ignore versions. 38 | $LatestVersionOnly = $False 39 | 40 | #If Microsoft decides to change their naming scheme you will need to update this variable to support the new scheme. 41 | $KnownEditions = @( 42 | "Office 2019 Perpetual Enterprise Client Update Version Perpetual", 43 | "Office LTSC 2021 Client Update Version Perpetual", 44 | "Microsoft 365 Apps Update - Current Channel Version", 45 | "Microsoft 365 Apps Update - Current Channel \(Preview\) Version", 46 | "Microsoft 365 Apps Update - Monthly Enterprise Channel Version", 47 | "Microsoft 365 Apps Update - Semi-Annual Enterprise Channel Version", 48 | "Microsoft 365 Apps Update - Semi-Annual Enterprise Channel \(Preview\) Version", 49 | "Microsoft 365 Apps Update for Windows 7 - Version", 50 | "Office 365 Client Update for Windows 7 - Version", 51 | "Office 365 Client Update - Current Channel \(Preview\) Version", 52 | "Office 365 Client Update - Current Channel", 53 | "Office 365 Client Update - Deferred Channel", 54 | "Office 365 Client Update - First Release for Current Channel", 55 | "Office 365 Client Update - First Release for Deferred Channel", 56 | "Office 365 Client Update - Monthly Channel Version", 57 | "Office 365 Client Update - Monthly Channel \(Targeted\) Version", 58 | "Office 365 Client Update - Monthly Enterprise Channel Version", 59 | "Office 365 Client Update - Semi-Annual Enterprise Channel Version", 60 | "Office 365 Client Update - Semi-Annual Enterprise Channel \(Preview\) Version" 61 | "Office 365 Client Update - Semi-annual Channel Version", 62 | "Office 365 Client Update - Semi-annual Channel \(Targeted\) Version" 63 | ) 64 | Function Invoke-SelectUpdatesPlugin { 65 | 66 | 67 | $DeclineUpdates = @{} 68 | If (!$SupportedEditions) { 69 | Return $DeclineUpdates 70 | } 71 | $maxVersions = @{} 72 | 73 | $Office365Updates = ($ActiveUpdates | Where-Object {$_.ProductTitles.Contains('Office 365 Client') -or $_.ProductTitles.Contains('Microsoft 365 Apps/Office 2019/Office LTSC')}) 74 | Add-TextToCMLog $LogFile "$($Office365Updates.count) Office 365 Client/Microsoft 365 Apps/Office 2019/Office LTSC discovered" $PluginName 1 75 | 76 | #Loop through the updates and editions and determine the highest version number per edition. 77 | If ($LatestVersionOnly) { 78 | ForEach ($Update in $Office365Updates) { 79 | ForEach ($KnownEdition in $KnownEditions) { 80 | If ($Update.Title -match $KnownEdition) { 81 | If ($Update.Title -match "Version (\d+)") { 82 | If ($Matches[1] -gt $maxVersions[$KnownEdition]) { 83 | $maxVersions.Set_Item($KnownEdition, $Matches[1]) 84 | } 85 | } 86 | } 87 | } 88 | } 89 | } 90 | 91 | #Loop through the updates and decline the desired updates. 92 | ForEach ($Update in $Office365Updates) { 93 | ForEach ($KnownEdition in $KnownEditions) { 94 | 95 | #Verify that the update is a known edition. 96 | If ($Update.Title -match $KnownEdition) { 97 | 98 | #Determine if the update is a supported version and what known edition it is. 99 | $FoundSupportedVersion = $False 100 | $FoundEdition = "" 101 | ForEach ($SupportedEdition in $SupportedEditions) { 102 | If ($Update.Title -match $SupportedEdition) { 103 | $FoundSupportedVersion = $True 104 | $FoundEdition = $KnownEdition 105 | } 106 | } 107 | 108 | #Check for exclusions 109 | If (Test-Exclusions $Update) { 110 | #Do Nothing 111 | 112 | #If a supported version was found and we're only keeping the latest version. 113 | } ElseIf ($FoundSupportedVersion -and $LatestVersionOnly) { 114 | #Decline updates that are not the latest version. 115 | If ($Update.Title -notlike "*Version $($maxVersions[$KnownEdition])*") { 116 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Office 365 Updates: Version") 117 | } 118 | If ($Update.IsSuperseded -eq "True") { 119 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Office 365 Updates: Version") 120 | } 121 | #If a supported version was not found then decline it. 122 | } ElseIf (! $FoundSupportedVersion) { 123 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Office 365 Updates: Edition") 124 | } 125 | } #If a Known Edition 126 | } #ForEach Edition 127 | 128 | 129 | 130 | } #Office 365 Updates 131 | Return $DeclineUpdates 132 | } 133 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows10Editions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline updates for editions of Windows 10 your organization does not support. 19 | .DESCRIPTION 20 | Decline updates for editions of Windows 10 your organization does not support. 21 | .NOTES 22 | You must un-comment the $SupportedEditions variable and add the editions your organization supports. 23 | 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. 24 | Written By: Bryan Dam 25 | Version 1.0: 10/28/17 26 | Version 2.4: 07/20/18 27 | Added the business and consumer versions to the known edition strings. Note that this is a licensing distinction, not an OS edition where volume license equals business and everything else, including OEM, is considered consumer. 28 | Version 2.4.6: 12/20/19 29 | Add 1903+ and Insider product categories. 30 | #> 31 | 32 | #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. 33 | #$SupportedEditions = @("Feature update to Windows 10 Enterprise,","Feature update to Windows 10 \(business editions\),") 34 | 35 | #If Microsoft decides to change their naming scheme you will need to udpate this variable to support the new scheme. Note that commas are used to prevent mismatches. 36 | $KnownEditions=@("Feature update to Windows 10 Pro,","Feature update to Windows 10 Pro N,","Feature update to Windows 10 Enterprise,","Feature update to Windows 10 Enterprise N,", "Feature update to Windows 10 Education,","Feature update to Windows 10 Education N,","Feature update to Windows 10 Team,","Feature update to Windows 10 \(business editions\),", "Feature update to Windows 10 \(consumer editions\),") 37 | Function Invoke-SelectUpdatesPlugin{ 38 | 39 | $DeclineUpdates = @{} 40 | If (!$SupportedEditions){Return $DeclineUpdates} 41 | 42 | 43 | $Windows10Updates = $ActiveUpdates | Where{$_.ProductTitles.Contains('Windows 10') -or $_.ProductTitles.Contains('Windows 10, version 1903 and later') -or $_.ProductTitles.Contains('Windows Insider Pre-Release')} 44 | 45 | #Loop through the updates and decline any that match the version. 46 | ForEach ($Update in $Windows10Updates){ 47 | 48 | #Verify that the title matches one of the known edition. If not then skip the update. 49 | $EditionFound=$False 50 | ForEach ($Edition in $KnownEditions){ 51 | If ($Update.Title -match $Edition){$EditionFound=$True} 52 | } 53 | If(!$EditionFound){Continue} #Skip to the next update. 54 | 55 | #Verify that the title does not match any of the editions the user supports. 56 | $EditionFound=$False 57 | ForEach ($Edition in $SupportedEditions){ 58 | If ($Update.Title -match $Edition){$EditionFound=$True} 59 | } 60 | 61 | #If one of the supported editions was found then skip to the next update. 62 | If($EditionFound -or (Test-Exclusions $Update)){ 63 | Continue #Skip to the next update. 64 | } Else { 65 | $DeclineUpdates.Set_Item($Update.Id.UpdateId,"Windows 10 Edition") 66 | } 67 | } 68 | Return $DeclineUpdates 69 | } 70 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows10Languages.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline Windows 10 updates based on language. 19 | .DESCRIPTION 20 | Decline Windows 10 updates for languages that are not selected to download software update files in the Software Update Point component. 21 | .NOTES 22 | If you are using stand-alone WSUS be sure to modify the SupportedUpdateLanguages variable to hard code the languages you support. 23 | Be sure to always include an 'all' element for language-independant updates. 24 | 25 | 26 | Written By: Bryan Dam 27 | Version 1.0: 10/25/17 28 | Version 2.0: 04/16/18 29 | Add support for running against a stand-alone WSUS server. 30 | Version 2.4: 07/20/18 31 | Added support for Win 7 and 8.1 in place upgrade updates. 32 | Version 2.4.6: 12/19/19 33 | Include 'Windows Insider Pre-Release' product category to catch new 1909 FUs. 34 | #> 35 | 36 | 37 | Function Invoke-SelectUpdatesPlugin{ 38 | 39 | $DeclineUpdates = @{} 40 | 41 | #Determine how to create the supported update language array. 42 | If ($StandAloneWSUS){ 43 | $SupportedUpdateLanguages=@("en","all") 44 | } 45 | Else{ 46 | #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. 47 | $SupportedUpdateLanguages=((Get-CMSoftwareUpdatePointComponent).Props).Where({$_.PropertyName -eq 'SupportedUpdateLanguages'}).Value2 48 | If (!$SupportedUpdateLanguages){Return $DeclineUpdates} 49 | $SupportedUpdateLanguages = ($SupportedUpdateLanguages.ToLower() + ",all").Split(',') 50 | } 51 | 52 | 53 | #Get the Windows 10 updates. 54 | $Windows10Updates = $ActiveUpdates | Where{($_.ProductTitles.Contains('Windows 10')) -or $_.ProductTitles.Contains('Windows 10, version 1903 and later') -or $_.ProductTitles.Contains('Windows Insider Pre-Release') -or ($_.Title -ilike "Windows 7 and 8.1 upgrade to Windows 10*")} 55 | 56 | #Loop through the updates and decline any that don't support the defined languages. 57 | ForEach ($Update in $Windows10Updates){ 58 | 59 | #Loop through the updates's languages and determine if one of the defined languages is found. 60 | $LanguageFound = $False 61 | ForEach ($Language in $Update.GetSupportedUpdateLanguages()){ 62 | If ($SupportedUpdateLanguages.Contains($Language)) {$LanguageFound=$True} 63 | } 64 | 65 | #If none of the defined languages were found then decline the update. 66 | If (! $LanguageFound -and (! (Test-Exclusions $Update))){ 67 | $DeclineUpdates.Set_Item($Update.Id.UpdateId,"Windows 10 Language: $($Update.GetSupportedUpdateLanguages())") 68 | } 69 | } 70 | Return $DeclineUpdates 71 | } 72 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows10Versions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline updates for defined versions of Windows 10. 19 | .DESCRIPTION 20 | Decline updates for defined versions of Windows 10. 21 | .NOTES 22 | You must un-comment the $UnsupportedVersions variable and add the versions your organization does not support. 23 | Written By: Bryan Dam 24 | Version 1.0: 10/25/17 25 | Version 2.4: 07/20/18 26 | Added support for Win 7 and 8.1 in place upgrade updates. 27 | Version 2.4.6: 12/20/19 28 | Add 1903+ and Insider product categories. 29 | Version 2.5.0: 03/31/21 30 | Add support for new version conventions (20H2, etc.) 31 | #> 32 | 33 | #Un-comment and add elements to this array for versions you no longer support. 34 | #$UnsupportedVersions = @("1507","1511", "1607") 35 | Function Invoke-SelectUpdatesPlugin{ 36 | 37 | $DeclineUpdates = @{} 38 | If (!$UnsupportedVersions){ 39 | Return $DeclineUpdates 40 | } 41 | 42 | $Windows10Updates = ($ActiveUpdates | Where-Object{ 43 | $_.ProductTitles.Contains('Windows 10') -or 44 | $_.ProductTitles.Contains('Windows 10, version 1903 and later') -or 45 | $_.ProductTitles.Contains('Windows Insider Pre-Release') -or 46 | $_.Title -ilike 'Windows 7 and 8.1 upgrade to Windows 10*' 47 | }) 48 | 49 | #Loop through the updates and decline any that match the version. 50 | ForEach ($Update in $Windows10Updates){ 51 | 52 | #If the title contains a version number. 53 | If ( 54 | ($Update.Title -match 'Version \d\d\d\d') -or ($Update.Title -match 'Version \d\d[Hh][1-2]') -and 55 | (! (Test-Exclusions $Update)) 56 | ){ 57 | 58 | #Capture the version number. 59 | $Version = $matches[0].Substring($matches[0].Length - 4) 60 | 61 | #If the version number is in the list then decline it. 62 | If ($UnsupportedVersions.Contains($Version)){ 63 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Windows 10 Version: $($Version)") 64 | } 65 | } 66 | } 67 | Return $DeclineUpdates 68 | } 69 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows10Versions_MinusLTSB.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline updates for defined versions of Windows 10 except for LTSB. 19 | .DESCRIPTION 20 | Decline updates for defined versions of Windows 10 except for LTSB. 21 | .NOTES 22 | You must un-comment the $UnsupportedVersions variable and add the versions your organization does not support. 23 | Written By: Bryan Dam 24 | Version 1.0: 7/31/18 25 | Version 2.4.6: 12/20/19 26 | Add 1903+ and Insider product categories. 27 | Version 2.5.0: 03/31/21 28 | Add support for new version conventions (20H2, etc.) 29 | #> 30 | 31 | #Un-comment and add elements to this array for versions you no longer support. 32 | #$UnsupportedVersions = @("1507","1511", "1607") 33 | Function Invoke-SelectUpdatesPlugin{ 34 | 35 | $DeclineUpdates = @{} 36 | If (!$UnsupportedVersions){ 37 | Return $DeclineUpdates 38 | } 39 | 40 | $Windows10Updates = ($ActiveUpdates | Where-Object{ 41 | ( 42 | ( 43 | ( 44 | $_.ProductTitles.Contains('Windows 10') -or 45 | $_.ProductTitles.Contains('Windows 10, version 1903 and later') -or 46 | $_.ProductTitles.Contains('Windows Insider Pre-Release') 47 | ) -and 48 | (! $_.ProductTitles.Contains('Windows 10 LTSB')) 49 | ) -or 50 | ($_.Title -ilike 'Windows 7 and 8.1 upgrade to Windows 10*') 51 | ) 52 | }) 53 | 54 | #Loop through the updates and decline any that match the version. 55 | ForEach ($Update in $Windows10Updates){ 56 | 57 | #If the title contains a version number. 58 | If ( 59 | ($Update.Title -match 'Version \d\d\d\d') -or ($Update.Title -match 'Version \d\d[Hh][1-2]') -and 60 | (! (Test-Exclusions $Update)) 61 | ){ 62 | 63 | #Capture the version number. 64 | $Version = $matches[0].Substring($matches[0].Length - 4) 65 | 66 | #If the version number is in the list then decline it. 67 | If ($UnsupportedVersions.Contains($Version)){ 68 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Windows 10 Version: $($Version)") 69 | } 70 | } 71 | } 72 | Return $DeclineUpdates 73 | } 74 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Editions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline updates for editions of Windows 11 your organization does not support. 19 | .DESCRIPTION 20 | Decline updates for editions of Windows 11 your organization does not support. 21 | .NOTES 22 | You must un-comment the $SupportedEditions variable and add the editions your organization supports. 23 | 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. 24 | Written By: Damien Solodow 25 | Version 1.0: 01/15/2024 26 | #> 27 | 28 | #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. 29 | #$SupportedEditions = @("Windows 11 \(business editions\),","Upgrade to Windows 11 \(business editions\)") 30 | 31 | #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. 32 | $KnownEditions = @( 33 | 'Upgrade to Windows 11 \(business editions\)', 34 | 'Upgrade to Windows 11 \(consumer editions\)' 35 | 'Windows 11 \(consumer editions\),' 36 | 'Windows 11 \(business editions\),' 37 | ) 38 | Function Invoke-SelectUpdatesPlugin{ 39 | 40 | $DeclineUpdates = @{} 41 | If (!$SupportedEditions){ 42 | Return $DeclineUpdates 43 | } 44 | 45 | 46 | $Windows11Updates = $ActiveUpdates | Where-Object{$_.ProductTitles.Contains('Windows 11')} 47 | 48 | #Loop through the updates and decline any that match the version. 49 | ForEach ($Update in $Windows11Updates){ 50 | 51 | #Verify that the title matches one of the known edition. If not then skip the update. 52 | $EditionFound = $False 53 | ForEach ($Edition in $KnownEditions){ 54 | If ($Update.Title -match $Edition){ 55 | $EditionFound = $True 56 | } 57 | } 58 | If(!$EditionFound){ 59 | Continue 60 | } #Skip to the next update. 61 | 62 | #Verify that the title does not match any of the editions the user supports. 63 | $EditionFound = $False 64 | ForEach ($Edition in $SupportedEditions){ 65 | If ($Update.Title -match $Edition){ 66 | $EditionFound = $True 67 | } 68 | } 69 | 70 | #If one of the supported editions was found then skip to the next update. 71 | If($EditionFound -or (Test-Exclusions $Update)){ 72 | Continue #Skip to the next update. 73 | } Else { 74 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, 'Windows 11 Edition') 75 | } 76 | } 77 | Return $DeclineUpdates 78 | } 79 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Languages.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline Windows 11 updates based on language. 19 | .DESCRIPTION 20 | Decline Windows 11 updates for languages that are not selected to download software update files in the Software Update Point component. 21 | .NOTES 22 | If you are using stand-alone WSUS be sure to modify the SupportedUpdateLanguages variable to hard code the languages you support. 23 | Be sure to always include an 'all' element for language-independant updates. 24 | 25 | 26 | Written By: Damien Solodow 27 | Version 1.0: 01/15/2024 28 | #> 29 | 30 | 31 | Function Invoke-SelectUpdatesPlugin{ 32 | 33 | $DeclineUpdates = @{} 34 | 35 | #Determine how to create the supported update language array. 36 | If ($StandAloneWSUS){ 37 | $SupportedUpdateLanguages = @('en', 'all') 38 | } Else{ 39 | #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. 40 | $SupportedUpdateLanguages = ((Get-CMSoftwareUpdatePointComponent).Props).Where({$_.PropertyName -eq 'SupportedUpdateLanguages'}).Value2 41 | If (!$SupportedUpdateLanguages){ 42 | Return $DeclineUpdates 43 | } 44 | $SupportedUpdateLanguages = ($SupportedUpdateLanguages.ToLower() + ',all').Split(',') 45 | } 46 | 47 | 48 | #Get the Windows 11 updates. 49 | $Windows11Updates = $ActiveUpdates | Where-Object{($_.ProductTitles.Contains('Windows 11'))} 50 | 51 | #Loop through the updates and decline any that don't support the defined languages. 52 | ForEach ($Update in $Windows11Updates){ 53 | 54 | #Loop through the updates's languages and determine if one of the defined languages is found. 55 | $LanguageFound = $False 56 | ForEach ($Language in $Update.GetSupportedUpdateLanguages()){ 57 | If ($SupportedUpdateLanguages.Contains($Language)) { 58 | $LanguageFound = $True 59 | } 60 | } 61 | 62 | #If none of the defined languages were found then decline the update. 63 | If (! $LanguageFound -and (! (Test-Exclusions $Update))){ 64 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Windows 11 Language: $($Update.GetSupportedUpdateLanguages())") 65 | } 66 | } 67 | Return $DeclineUpdates 68 | } 69 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows11Versions.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline updates for defined versions of Windows 11. 19 | .DESCRIPTION 20 | Decline updates for defined versions of Windows 11. 21 | .NOTES 22 | You must un-comment the $UnsupportedVersions variable and add the versions your organization does not support. 23 | Written By: Damien Solodow 24 | Version 1.0: 01/15/2024 25 | #> 26 | 27 | #Un-comment and add elements to this array for versions you no longer support. 28 | #$UnsupportedVersions = @("22H2") 29 | Function Invoke-SelectUpdatesPlugin{ 30 | 31 | $DeclineUpdates = @{} 32 | If (!$UnsupportedVersions){ 33 | Return $DeclineUpdates 34 | } 35 | 36 | $Windows11Updates = ($ActiveUpdates | Where-Object{ 37 | $_.ProductTitles.Contains('Windows 11') 38 | }) 39 | 40 | #Loop through the updates and decline any that match the version. 41 | ForEach ($Update in $Windows11Updates){ 42 | 43 | #If the title contains a version number. 44 | If ( 45 | ($Update.Title -match 'Version \d\d\d\d') -or ($Update.Title -match 'Version \d\d[Hh][1-2]') -and 46 | (! (Test-Exclusions $Update)) 47 | ){ 48 | 49 | #Capture the version number. 50 | $Version = $matches[0].Substring($matches[0].Length - 4) 51 | 52 | #If the version number is in the list then decline it. 53 | If ($UnsupportedVersions.Contains($Version)){ 54 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Windows 11 Version: $($Version)") 55 | } 56 | } 57 | } 58 | Return $DeclineUpdates 59 | } 60 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-Windows7IPUs.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Decline updates for Windows 7 and 8.1 inplace upgrades to Windows 10. 19 | .DESCRIPTION 20 | Decline updates for Windows 7 and 8.1 inplace upgrades to Windows 10. 21 | .NOTES 22 | Written By: Bryan Dam 23 | Version 1.0: 07/25/18 24 | #> 25 | 26 | Function Invoke-SelectUpdatesPlugin{ 27 | $DeclineUpdates = @{} 28 | $WindowsIPUUpdates = ($ActiveUpdates | Where-Object {$_.Title -ilike "Windows 7 and 8.1 upgrade to Windows 10*"}) 29 | #Loop through the updates and decline them all. 30 | ForEach ($Update in $WindowsIPUUpdates) { 31 | $DeclineUpdates.Set_Item($Update.Id.UpdateId,"Windows 7 IPU") 32 | } 33 | Return $DeclineUpdates 34 | } 35 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-WindowsARM64.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | ################################################################################ 17 | #.SYNOPSIS 18 | # Decline-WindowsARM64.ps1 19 | # A helper script function to identify Windows AMD64 updates 20 | # for declining in WSUS and expiring in ConfigMgr/SCCM 21 | #.LINK 22 | # Reference Invoke-DGASoftwareUpdateMaintenance.ps1 23 | #.NOTES 24 | # This script is invoked by Invoke-DGASoftwareUpdateMaintenance.ps1 and not run independently 25 | # 26 | # ========== Keywords ========== 27 | # Keywords: WSUS SUP SCCM ConfigMgr Decline Expire Update Maintenance Superseded 28 | # ========== Change Log History ========== 29 | # - 2020/08/13 by Chad.Simmons@CatapultSystems.com - Created 30 | # - 2020/08/13 by Chad@ChadsTech.net - Created 31 | # === To Do / Proposed Changes === 32 | # - TODO: None 33 | ################################################################################ 34 | 35 | Function Invoke-SelectUpdatesPlugin{ 36 | $PluginName = 'Decline-WindowsARM64' 37 | $DeclineUpdates = @{} 38 | $WindowsARM64Updates = ($ActiveUpdates | Where-Object {($_.LegacyName -like '*-ARM64-*' -or $_.Title -like '* ARM64*' -or $_.Title -like '* for ARM64 *')}) 39 | Add-TextToCMLog $LogFile "$($WindowsARM64Updates.count) Windows ARM64 Updates discovered" $PluginName 1 40 | #Loop through the updates and decline any that match the version. 41 | ForEach ($Update in $WindowsARM64Updates) { 42 | $DeclineUpdates.Set_Item($Update.Id.UpdateId,"Windows ARM64") 43 | } 44 | Return $DeclineUpdates 45 | } -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-WindowsItanium.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | ################################################################################ 17 | #.SYNOPSIS 18 | # Decline-WindowsItanium.ps1 19 | # A helper script function to identify Windows Itanium, IA64 and AMD64 updates 20 | # for declining in WSUS and expiring in ConfigMgr/SCCM 21 | #.LINK 22 | # Reference Invoke-DGASoftwareUpdateMaintenance.ps1 23 | #.NOTES 24 | # This script is invoked by Invoke-DGASoftwareUpdateMaintenance.ps1 and not run independently 25 | # 26 | # ========== Keywords ========== 27 | # Keywords: WSUS SUP SCCM ConfigMgr Decline Expire Update Maintenance Superseded 28 | # ========== Change Log History ========== 29 | # - 2020/08/13 by Chad.Simmons@CatapultSystems.com - added additional logging 30 | # - 2019/09/19 by Charles - Some Itanium or IA64 updates were not declined, changed $_.ProductTitles to $_.Title 31 | # - 2018/04/30 by Chad.Simmons@CatapultSystems.com - Created 32 | # - 2018/04/30 by Chad@ChadsTech.net - Created 33 | # === To Do / Proposed Changes === 34 | # - TODO: None 35 | ################################################################################ 36 | 37 | Function Invoke-SelectUpdatesPlugin{ 38 | $PluginName = 'Decline-WindowsItanium' 39 | $DeclineUpdates = @{} 40 | $WindowsItaniumUpdates = ($ActiveUpdates | Where-Object {($_.LegacyName -like '*-IA64-*' -or $_.Title -like '* Itanium*' -or $_.Title -like '* for IA64 *')}) 41 | Add-TextToCMLog $LogFile "$($WindowsItaniumUpdates.count) Windows Itanium Updates discovered" $PluginName 1 42 | #Loop through the updates and decline any that match the version. 43 | ForEach ($Update in $WindowsItaniumUpdates) { 44 | $DeclineUpdates.Set_Item($Update.Id.UpdateId,"Windows Itanium") 45 | } 46 | Return $DeclineUpdates 47 | } 48 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-WindowsX86.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | ################################################################################ 17 | #.SYNOPSIS 18 | # Decline-WindowsX86.ps1 19 | # A helper script function to identify Windows 32-bit updates 20 | # for declining in WSUS and expiring in ConfigMgr/SCCM 21 | #.LINK 22 | # Reference Invoke-DGASoftwareUpdateMaintenance.ps1 23 | #.NOTES 24 | # This script is invoked by Invoke-DGASoftwareUpdateMaintenance.ps1 and not run independently 25 | # 26 | # ========== Keywords ========== 27 | # Keywords: WSUS SUP SCCM MECM MEMCM ConfigMgr Decline Expire Update Maintenance Superseded 28 | # ========== Change Log History ========== 29 | # - 2022/08/24 by Chad.Simmons@Quisitive.com - Updated documentation for clarity 30 | # - 2018/07/27 by Chad.Simmons@CatapultSystems.com - Changed Decline Reason to include matching ProductTitle 31 | # - 2018/07/11 by Chad.Simmons@CatapultSystems.com - Added functionality for supported 32-bit operating systems so unsupported ones are declined 32 | # - 2018/04/30 by Chad.Simmons@CatapultSystems.com - Created 33 | # - 2018/04/30 by Chad@ChadsTech.net - Created 34 | ################################################################################ 35 | 36 | #Add a Product to KEEP related x86 Updates. All Updates NOT associated with one of these Products will be declined 37 | $SupportedWinX86Versions = @('Windows Server 2003, Datacenter Edition', 'Windows Server 2003', 'Windows Server 2008', 'Windows XP', 'Windows 7') 38 | <#Known Windows 32-bit Products / ProductTitles 39 | Windows Server 2003 40 | Datacenter Edition 41 | Windows Server 2003 42 | Windows Server 2008 43 | Windows XP 44 | Windows 7 45 | Windows 8 46 | Windows 8.1 47 | Windows 10 48 | #> 49 | 50 | Function Invoke-SelectUpdatesPlugin { 51 | $DeclineUpdates = @{} 52 | $WindowsX86Updates = ($ActiveUpdates | Where-Object {($_.LegacyName -notlike '*DOTNET*-X86-TSL') -and ($_.LegacyName -like 'WSUS*_x86' -or $_.LegacyName -like '*WINDOWS*-KB*-X86-*' -or $_.LegacyName -like 'KB*-*-X86-TSL')}) 53 | #Example: WINDOWS7CLIENT-KB982799-X86-308159-23798 54 | #Example: WINDOWS7EMBEDDED-KB2124261-X86-325274-25932 55 | #Example: KB4099989-Windows10Rs3Client-RTM-ServicingStackUpdate-X86-TSL-World 56 | #Example: KB947821-Win7-SP1-X86-TSL 57 | #Example: WINDOWS6-1-KB975891-X86-294176 58 | Add-TextToCMLog $LogFile " Supported Windows X86 Products: $($SupportedWinX86Versions -join '; '). All others will be declined." $component 1 59 | 60 | #Loop through the updates and decline any that are not in the Supported products list 61 | ForEach ($update in $WindowsX86Updates) { 62 | If (($update.ProductTitles | Select-String -pattern $SupportedWinX86Versions -SimpleMatch -List).Count -eq 0) { 63 | $DeclineUpdates.Set_Item($Update.Id.UpdateId, "Unsupported OS: $($update.ProductTitles) (32-bit)") 64 | } 65 | } 66 | Write-Debug -Message 'Explore $Updates, $DeclineUpdates, $WindowsX86Updates and $SupportedWinX86Versions' 67 | Return $DeclineUpdates 68 | } -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Decline-WindowsX86_Minus2008.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | ################################################################################ 17 | #.SYNOPSIS 18 | # Decline-WindowsX86.ps1 19 | # A helper script function to identify Windows 32-bit updates 20 | # for declining in WSUS and expiring in ConfigMgr/SCCM 21 | #.LINK 22 | # Reference Invoke-DGASoftwareUpdateMaintenance.ps1 23 | #.NOTES 24 | # This script is invoked by Invoke-DGASoftwareUpdateMaintenance.ps1 and not run independently 25 | # 26 | # This script is maintained at https://github.com/ChadSimmons/Scripts 27 | # Additional information about the function or script. 28 | # ========== Keywords ========== 29 | # Keywords: WSUS SUP SCCM ConfigMgr Decline Expire Update Maintenance Superseded 30 | # ========== Change Log History ========== 31 | # - 2018/04/30 by Chad.Simmons@CatapultSystems.com - Created 32 | # - 2018/04/30 by Chad@ChadsTech.net - Created 33 | # === To Do / Proposed Changes === 34 | # - TODO: None 35 | ################################################################################ 36 | 37 | 38 | Function Invoke-SelectUpdatesPlugin{ 39 | $DeclineUpdates = @{} 40 | $WindowsX86Updates = ($ActiveUpdates | Where{($_.Title -notlike '*.NET*') -and ($_.Title -ilike '*x86*') -and ($_.ProductTitles -ilike '*Windows*') -and (!$_.ProductTitles.Contains('Windows Server 2008'))}) 41 | #WINDOWS7CLIENT-KB982799-X86-308159-23798 42 | #WINDOWS7EMBEDDED-KB2124261-X86-325274-25932 43 | #KB4099989-Windows10Rs3Client-RTM-ServicingStackUpdate-X86-TSL-World 44 | #KB947821-Win7-SP1-X86-TSL 45 | #WINDOWS6-1-KB975891-X86-294176 46 | 47 | #Loop through the updates and decline any that match the version. 48 | ForEach ($Update in $WindowsX86Updates) { 49 | $DeclineUpdates.Set_Item($Update.Id.UpdateId,"Windows X86 (32-bit)") 50 | } 51 | Return $DeclineUpdates 52 | } 53 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/Plugins/Disabled/Template.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This program is free software: you can redistribute it and/or modify 3 | it under the terms of the GNU General Public License as published by 4 | the Free Software Foundation, either version 3 of the License, or 5 | (at your option) any later version. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program. If not, see . 14 | #> 15 | 16 | <# 17 | .SYNOPSIS 18 | Enter your synopsis here. 19 | .DESCRIPTION 20 | Provide a more full description here. 21 | .NOTES 22 | Written By: 23 | Version 1.0: 10/28/17 24 | Version 1.1: 08/31/18 25 | #> 26 | 27 | Function Invoke-SelectUpdatesPlugin{ 28 | 29 | $DeclineUpdates = @{} 30 | 31 | $UpdatesIMightHate = ($ActiveUpdates | Where {$_.Title -ilike '%Du.Du hast.Du hast mich%'}) 32 | 33 | #Loop through the updates. 34 | ForEach ($Update in $UpdatesIMightHate){ 35 | 36 | #Verify that the updates aren't being excluded. 37 | If (!Test-Exclusions $Update){ 38 | 39 | #Enter all your fun logic to add updates to the hashtable. 40 | #$DeclineUpdates.Set_Item($Update.Id.UpdateId,"Reason for Declining") 41 | } 42 | } 43 | 44 | Return $DeclineUpdates 45 | } 46 | -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/config.ini: -------------------------------------------------------------------------------- 1 | ;Example configuration file 2 | ;Note-You will need to remove the WhatIfPreference configuration before changes to your environment will be made. 3 | 4 | CleanSources 5 | CleanSUGs 6 | CombineSUGs=3 7 | DeclineByPlugins 8 | DeclineByTitle=@('*Security Only*','*Preview of*','(Preview)*','*Itanium*','*ia64*','*Beta*','*Version Next*') 9 | ;DeclineLastLevelOnly 10 | DeclineSuperseded 11 | DeleteDeclined 12 | ;ExcludeByProduct=@('*name*','*name*') 13 | ;ExcludeByTitle=@('*name*','*name*') 14 | ;ExclusionPeriod=3 15 | ;FirstRun 16 | ;Force 17 | ;IncludeByProduct=@('*name*','*name*') 18 | ;LogFile=\\#YourPath#\Invoke-DGASoftwareUpdateMaintenance.log 19 | ;UpdateListOutputFile=\\#YourPath#\Invoke-DGASoftwareUpdateMaintenance.csv 20 | ;DatFile=\\#YourPath#\Invoke-DGASoftwareUpdateMaintenance.dat 21 | ;MaxLogSize=2621440 22 | MaxUpdateRuntime=@{'*Cumulative Update for Windows 10*'=90;'*Security Monthly Quality Rollup For Windows*'=90;'*Security and Quality Rollup for .NET*'=90} 23 | RemoveEmptySUGs 24 | ReSyncUpdates 25 | RunCleanUpWizard 26 | ;SiteCode=XYZ 27 | ;StandAloneWSUS=MyWSUSserver.contoso.com 28 | ;StandAloneWSUSPort=8530 29 | ;StandAloneWSUSSSL=$False 30 | ;SyncLeadTime=5 31 | UpdateADRDeploymentPackages=Yearly 32 | UpdateListOutputFile 33 | UseCustomIndexes 34 | WhatIfPreference -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdateMaintenance/config_wsus_standalone.ini: -------------------------------------------------------------------------------- 1 | ;Example configuration file for standalone WSUS 2 | ;Note-You will need to remove the WhatIfPreference configuration before changes to your environment will be made. 3 | 4 | DeclineByPlugins 5 | DeclineByTitle=@('*Security Only*','*Preview of*','(Preview)*','*Itanium*','*ia64*','*Beta*','*Version Next*') 6 | ;DeclineLastLevelOnly 7 | DeclineSuperseded 8 | DeleteDeclined 9 | ;ExcludeByProduct=@('*name*','*name*') 10 | ;ExcludeByTitle=@('*name*','*name*') 11 | ;ExclusionPeriod=3 12 | ;FirstRun 13 | ;Force 14 | ;IncludeByProduct=@('*name*','*name*') 15 | ;LogFile=\\#YourPath#\Invoke-DGASoftwareUpdateMaintenance.log 16 | ;MaxLogSize=2621440 17 | RunCleanUpWizard 18 | StandAloneWSUS=localhost 19 | ;StandAloneWSUSPort=8530 20 | ;StandAloneWSUSSSL=$False 21 | ;SyncLeadTime=5 22 | UpdateListOutputFile 23 | UseCustomIndexes 24 | WhatIfPreference -------------------------------------------------------------------------------- /Invoke-DGASoftwareUpdatePointSync.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Run the software update synchronization. 4 | .DESCRIPTION 5 | This script can be used to initiate the syncronization of software updates. 6 | .EXAMPLE 7 | Invoke-SoftwareUpdatePointSync.ps1 -WeekOfPatchTuesday -FullSync 8 | Initiate a full software update sync if the current date is within 7 days of this month's Patch Tuesday. 9 | .EXAMPLE 10 | Invoke-SoftwareUpdatePointSync.ps1 -Wait -Force 11 | Initiate a sync and wait for it complete even if the script was ran in the last 24 hours. 12 | .NOTES 13 | Written By: Bryan Dam 14 | Version 1.0: 10/11/17 15 | Version 1.1: 11/16/17 16 | #> 17 | 18 | [CmdletBinding(SupportsShouldProcess=$True)] 19 | Param( 20 | 21 | #Set the log file. 22 | [string] $LogFile, 23 | 24 | #The maximum size of the log in bytes. 25 | [int]$MaxLogSize = 2621440, 26 | 27 | #Force the script to run even if it was ran recently. 28 | [switch]$Force, 29 | 30 | #Wait for the Sync to finish. 31 | [switch]$Wait, 32 | 33 | #Only run the script within a week of Patch Tuesday. 34 | [switch] $WeekOfPatchTuesday, 35 | 36 | #Initiate a full sync rather than an incremental one. This is enabled by default. 37 | [bool]$FullSync=$True, 38 | 39 | #Define the sitecode. 40 | [string] $SiteCode 41 | ) 42 | 43 | #Taken from https://gallery.technet.microsoft.com/scriptcenter/Add-TextToCMLog-Function-ea238b85 44 | Function Add-TextToCMLog { 45 | ########################################################################################################## 46 | <# 47 | .SYNOPSIS 48 | Log to a file in a format that can be read by Trace32.exe / CMTrace.exe 49 | 50 | .DESCRIPTION 51 | Write a line of data to a script log file in a format that can be parsed by Trace32.exe / CMTrace.exe 52 | 53 | The severity of the logged line can be set as: 54 | 55 | 1 - Information 56 | 2 - Warning 57 | 3 - Error 58 | 59 | Warnings will be highlighted in yellow. Errors are highlighted in red. 60 | 61 | The tools to view the log: 62 | 63 | SMS Trace - http://www.microsoft.com/en-us/download/details.aspx?id=18153 64 | CM Trace - Installation directory on Configuration Manager 2012 Site Server - \tools\ 65 | 66 | .EXAMPLE 67 | Add-TextToCMLog c:\output\update.log "Application of MS15-031 failed" Apply_Patch 3 68 | 69 | This will write a line to the update.log file in c:\output stating that "Application of MS15-031 failed". 70 | The source component will be Apply_Patch and the line will be highlighted in red as it is an error 71 | (severity - 3). 72 | 73 | #> 74 | ########################################################################################################## 75 | 76 | #Define and validate parameters 77 | [CmdletBinding()] 78 | Param( 79 | #Path to the log file 80 | [parameter(Mandatory=$True)] 81 | [String]$LogFile, 82 | 83 | #The information to log 84 | [parameter(Mandatory=$True)] 85 | [String]$Value, 86 | 87 | #The source of the error 88 | [parameter(Mandatory=$True)] 89 | [String]$Component, 90 | 91 | #The severity (1 - Information, 2- Warning, 3 - Error) 92 | [parameter(Mandatory=$True)] 93 | [ValidateRange(1,3)] 94 | [Single]$Severity 95 | ) 96 | 97 | 98 | #Obtain UTC offset 99 | $DateTime = New-Object -ComObject WbemScripting.SWbemDateTime 100 | $DateTime.SetVarDate($(Get-Date)) 101 | $UtcValue = $DateTime.Value 102 | $UtcOffset = $UtcValue.Substring(21, $UtcValue.Length - 21) 103 | 104 | 105 | #Create the line to be logged 106 | $LogLine = "" +` 107 | "" 114 | 115 | #Write the line to the passed log file 116 | Out-File -InputObject $LogLine -Append -NoClobber -Encoding Default -FilePath $LogFile -WhatIf:$False 117 | 118 | } 119 | ########################################################################################################## 120 | 121 | #Note: This function is provided in 1706 so this is just a stop-gab until that version has reached critical mass. 122 | Function Get-CMSoftwareUpdateSyncStatus { 123 | ########################################################################################################## 124 | <# 125 | .SYNOPSIS 126 | Returns the sync status for each software update point in the site. 127 | #> 128 | ########################################################################################################## 129 | 130 | $SyncStatus = Get-WmiObject -Namespace "ROOT\SMS\site_$($SiteCode)" -Query "Select * from SMS_SUPSyncStatus" 131 | $Results = @() 132 | 133 | #Cretae a new object to convert WMI's CIM_DATETIME to PowerShell DateTime 134 | ForEach ($status in $SyncStatus){ 135 | If ($status.LastReplicationLinkCheckTime){ $LastReplicationLinkCheckTime = [Management.ManagementDateTimeConverter]::ToDateTime($status.LastReplicationLinkCheckTime)} 136 | If ($status.LastSuccessfulSyncTime){ $LastSuccessfulSyncTime = [Management.ManagementDateTimeConverter]::ToDateTime($status.LastSuccessfulSyncTime)} 137 | If ($status.LastSyncStateTime){ $LastSyncStateTime = [Management.ManagementDateTimeConverter]::ToDateTime($status.LastSyncStateTime)} 138 | 139 | 140 | $properties = @{'LastReplicationLinkCheckTime'=$LastReplicationLinkCheckTime; 141 | 'LastSuccessfulSyncTime'=$LastSuccessfulSyncTime; 142 | 'LastSyncErrorCode'=$status.LastSyncErrorCode; 143 | 'LastSyncState'=$status.LastSyncState; 144 | 'LastSyncStateTime'=$LastSyncStateTime; 145 | 'ReplicationLinkStatus'=$status.ReplicationLinkStatus; 146 | 'SiteCode'=$status.SiteCode; 147 | 'SyncCatalogVersion'=$status.SyncCatalogVersion; 148 | 'WSUSServerName'=$status.WSUSServerName; 149 | 'WSUSSourceServer'=$status.WSUSSourceServer} 150 | 151 | $Results+= New-Object �TypeName PSObject �Prop $properties 152 | } 153 | 154 | 155 | Return $Results 156 | 157 | } 158 | ########################################################################################################## 159 | 160 | Function Invoke-SyncCheck { 161 | ########################################################################################################## 162 | <# 163 | .SYNOPSIS 164 | Invoke a syncronization check on all software update points. 165 | 166 | .DESCRIPTION 167 | When ran this function will wait for the software update point syncronization process to complete 168 | successfully before continuing. 169 | 170 | .EXAMPLE 171 | Invoke-SyncCheck 172 | 173 | #> 174 | ########################################################################################################## 175 | [CmdletBinding()] 176 | Param( 177 | #The number of minutes to wait after the last sync to run the wizard. 178 | [int]$SyncLeadTime = 5 179 | ) 180 | 181 | $WaitInterval = 0 #Used to skip the initial wait cycle if it isn't necessary. 182 | Do{ 183 | 184 | #Wait until the loop has iterated once. 185 | If ($WaitInterval -gt 0){ 186 | Add-TextToCMLog $LogFile "Waiting $TimeToWait minutes for lead time to pass before executing." $component 1 187 | Start-Sleep -Seconds ($WaitInterval) 188 | } 189 | 190 | #Loop through each SUP and wait until they are all done syncing. 191 | Do { 192 | #If syncronizing then wait. 193 | If($Syncronizing){ 194 | Add-TextToCMLog $LogFile "Waiting for software update points to stop syncing." $component 1 195 | Start-Sleep -Seconds (300) 196 | } 197 | 198 | <# 199 | Source: http://eskonr.com/2015/01/download-sccm-configmgr-2012-r2-cu3-status-messages-documentation/ 200 | 6701 = WSUS Synchronization started. 201 | 6702 = WSUS Synchronization done. 202 | 6703 = WSUS Synchronization failed. 203 | 6704 = WSUS Synchronization in progress. Current phase: Synchronizing WSUS Server. 204 | 6705 = WSUS Synchronization in progress. Current phase: Synchronizing site database. 205 | 6706 = WSUS Synchronization in progress. Current phase: Synchronizing Internet facing WSUS Server. 206 | 6707 = Content of WSUS Server %1 is out of sync with upstream server %2. 207 | 6708 = WSUS synchronization complete, with pending license terms downloads. 208 | #> 209 | $SynchronizingStatusMessages = @(6701,6704,6705,6706) 210 | 211 | $Syncronizing = $False 212 | ForEach ($softwareUpdatePointSyncStatus in Get-CMSoftwareUpdateSyncStatus){ 213 | If($softwareUpdatePointSyncStatus.LastSyncState -in $SynchronizingStatusMessages){$Syncronizing = $True} 214 | } 215 | } Until(!$Syncronizing) 216 | 217 | 218 | #Loop through each SUP, calculate the last sync time, and make sure that they all synced successfully. 219 | $syncTimeStamp = Get-Date "1/1/2001 12:00 AM" 220 | ForEach ($softwareUpdatePointSyncStatus in Get-CMSoftwareUpdateSyncStatus){ 221 | If ($softwareUpdatePointSyncStatus.LastSyncErrorCode -ne 0){ 222 | Add-TextToCMLog $LogFile "The software update point $($softwareUpdatePointSyncStatus.WSUSServerName) failed its last syncronization with error code $($softwareUpdatePointSyncStatus.LastSyncErrorCode). Syncronize successfully before running $component." $component 2 223 | Return 224 | } 225 | 226 | If ($syncTimeStamp -lt $softwareUpdatePointSyncStatus.LastSyncStateTime) { 227 | $syncTimeStamp = $softwareUpdatePointSyncStatus.LastSyncStateTime 228 | } 229 | } 230 | 231 | 232 | #Calculate the remaining time to wait for the lead time to expire. 233 | $TimeToWait = ($syncTimeStamp.AddMinutes($SyncLeadTime) - (Get-Date)).Minutes 234 | 235 | #Set the wait interval in seconds for subsequent loops. 236 | $WaitInterval = 300 237 | } Until ($TimeToWait -le 0) 238 | 239 | Add-TextToCMLog $LogFile "Software update point syncronization states confirmed." $component 1 240 | } 241 | ########################################################################################################## 242 | 243 | ########################################################################################################## 244 | function Test-RegistryValue { 245 | 246 | Param ( 247 | [parameter(Mandatory=$true)] 248 | [ValidateNotNullOrEmpty()]$Path, 249 | [parameter(Mandatory=$true)] 250 | [ValidateNotNullOrEmpty()]$Value 251 | ) 252 | 253 | Try { 254 | Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Value -ErrorAction Stop | Out-Null 255 | Return $true 256 | } catch { 257 | Return $false 258 | } 259 | } 260 | 261 | 262 | ########################################################################################################## 263 | 264 | 265 | ########################################################################################################## 266 | <# 267 | .SYNOPSIS 268 | Attempt to determine the current device's site code from the PS drive or registry. 269 | 270 | .DESCRIPTION 271 | When ran this function will look for a PS Drive and return its name. Otherwise it will look in the regisry. 272 | 273 | .EXAMPLE 274 | Get-SiteCode 275 | 276 | #> 277 | ########################################################################################################## 278 | Function Get-SiteCode { 279 | 280 | #See if a PSDrive exists with the CMSite provider 281 | $PSDriveExists = $False 282 | Try { 283 | Get-PSDrive -PSProvider CMSite -ErrorAction Stop | Out-Null 284 | $PSDriveExists = $False 285 | } catch { 286 | $PSDriveExists = $True 287 | } 288 | 289 | #If PSDrive exists then get the site code from it. Otherwise, try to create the drive. 290 | If ($PSDriveExists) { 291 | $SiteCode = Get-PSDrive -PSProvider CMSite 292 | } Else { 293 | #Try to determine the site code if none was passed in. 294 | If (-Not ($SiteCode) ) { 295 | If (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\SMS\Identification" -Value "Site Code"){ 296 | $SiteCode = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\SMS\Identification" | Select-Object -ExpandProperty "Site Code" 297 | } ElseIf (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client" -Value "AssignedSiteCode") { 298 | $SiteCode = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client" | Select-Object -ExpandProperty "AssignedSiteCode" 299 | } Else { 300 | Return 301 | } 302 | } 303 | } 304 | 305 | Return $SiteCode 306 | } 307 | ########################################################################################################## 308 | 309 | $cmSiteVersion = [version]"5.00.8540.1000" 310 | 311 | #If log file is null then set it to the default and then make the provider type explicit. 312 | If (!$LogFile){$LogFile = Join-Path $PSScriptRoot "supsync.log"} 313 | $LogFile = "filesystem::$($LogFile)" 314 | 315 | #Generate the compnent used for loggins based on the script name. 316 | $component = (Split-Path $PSCommandPath -Leaf).Replace(".ps1", "") 317 | 318 | #If the log file exists and is larger then the maximum then roll it over. 319 | If (Test-path $LogFile -PathType Leaf) { 320 | If ((Get-Item $LogFile).length -gt $MaxLogSize){ 321 | Move-Item -Force $LogFile ($LogFile -replace ".$","_") -WhatIf:$False 322 | } 323 | } 324 | 325 | Add-TextToCMLog $LogFile "$component started." $component 1 326 | 327 | #Check to see if this script has ran recently. 328 | $lastRanPath = "filesystem::$(Join-Path $PSScriptRoot "lastran_$($component)")" 329 | If (Test-Path -Path $lastRanPath -NewerThan ((get-date).AddHours(-24).ToString())){ 330 | If ($Force){ 331 | Add-TextToCMLog $LogFile "The script was ran in the last 24 hours but is being forced to run." $component 1 332 | } Else { 333 | Add-TextToCMLog $LogFile "The script was ran in the last 24 hours. Use the Force parameter to run the script anyways." $component 2 334 | Return 335 | } 336 | } 337 | 338 | #Make sure the last Patch Tuesday was less than a week away. 339 | If ($WeekOfPatchTuesday){ 340 | #Care of: http://www.madwithpowershell.com/2014/10/calculating-patch-tuesday-with.html 341 | $BaseDate = ( Get-Date -Day 12 ).Date 342 | $PatchTuesday = $BaseDate.AddDays( 2 - [int]$BaseDate.DayOfWeek ) 343 | If (((Get-Date) -lt $PatchTuesday) -or ((Get-Date) -gt $PatchTuesday.AddDays(7))){ 344 | Add-TextToCMLog $LogFile "Patch Tuesday is over a week ago. Exiting." $component 2 345 | Return 346 | } Else { 347 | Add-TextToCMLog $LogFile "Patch Tuesday was this week." $component 1 348 | } 349 | } 350 | 351 | 352 | #If the Configuration Manager module exists then load it. 353 | If (! $env:SMS_ADMIN_UI_PATH) 354 | { 355 | Add-TextToCMLog $LogFile "The SMS_ADMIN_UI_PATH environment variable is not set. Make sure the SCCM console it installed." $component 3 356 | Return 357 | } 358 | $configManagerCmdLetpath = Join-Path $(Split-Path $env:SMS_ADMIN_UI_PATH) "ConfigurationManager.psd1" 359 | If (! (Test-Path $configManagerCmdLetpath -PathType Leaf) ) 360 | { 361 | Add-TextToCMLog $LogFile "The ConfigurationManager Module file could not be found. Make sure the SCCM console it installed." $component 3 362 | Return 363 | } 364 | 365 | #You can't pass whatif to the Import-Module function and it spits out a lot of text, so work around it. 366 | $WhatIf = $WhatIfPreference 367 | $WhatIfPreference = $False 368 | Import-Module $configManagerCmdLetpath -Force 369 | $WhatIfPreference = $WhatIf 370 | 371 | #Get the site code 372 | If (!$SiteCode){$SiteCode = Get-SiteCode} 373 | 374 | #If the PS drive doesn't exist then try to create it. 375 | If (! (Test-Path "$($SiteCode):")) { 376 | Try{ 377 | Add-TextToCMLog $LogFile "Trying to create the PS Drive $($SiteCode)" $component 1 378 | New-PSDrive -Name $SiteCode -PSProvider CMSite -Root "." -WhatIf:$False | Out-Null 379 | } Catch { 380 | Add-TextToCMLog $LogFile "The site's PS drive doesn't exist nor could it be created." $component 3 381 | Add-TextToCMLog $LogFile "Error: $($_.Exception.Message)" $component 3 382 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 383 | Return 384 | } 385 | } 386 | 387 | #Change the directory to the site location. 388 | $OriginalLocation = Get-Location 389 | 390 | #Set and verify the location. 391 | Try{ 392 | Add-TextToCMLog $LogFile "Connecting to site: $($SiteCode)" $component 1 393 | Set-Location "$($SiteCode):" | Out-Null 394 | } Catch { 395 | Add-TextToCMLog $LogFile "Could not set location to site: $($SiteCode)." $component 3 396 | Add-TextToCMLog $LogFile "Error: $($_.Exception.Message)" $component 3 397 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 398 | Return 399 | } 400 | 401 | #Make sure the site code matches the PS drive's site code. 402 | If ($SiteCode -ne (Get-CMSite).SiteCode) { 403 | Add-TextToCMLog $LogFile "The site code $($SiteCode) does not match the current site $((Get-CMSite).SiteCode)." $component 3 404 | Return 405 | } 406 | 407 | #Verify the version of configuration manager. 408 | If ((Get-CMSite).Version -lt $cmSiteVersion){ 409 | Write-Warning "$($ModuleName) requires configuration manager cmdlets $($cmSiteVersion.ToString()) or greater." 410 | } 411 | 412 | #Try to initiate an update sync. 413 | Try 414 | { 415 | Sync-CMSoftwareUpdate -FullSync:$FullSync 416 | If ($FullSync){ 417 | Add-TextToCMLog $LogFile "Initiated a full software update sync." $component 1 418 | } Else { 419 | Add-TextToCMLog $LogFile "Initiated an incremental software update sync." $component 1 420 | } 421 | 422 | If ($Wait){ 423 | Start-Sleep -Seconds 30 424 | Add-TextToCMLog $LogFile "Initiating a sync check." $component 1 425 | Invoke-SyncCheck -SyncLeadTime 0 426 | } 427 | } 428 | Catch [System.Exception] 429 | { 430 | Add-TextToCMLog $LogFile "Failed to initiate an update sync.)" $component 3 431 | Add-TextToCMLog $LogFile "Error: $($_.Exception.Message)" $component 3 432 | Add-TextToCMLog $LogFile "$($_.InvocationInfo.PositionMessage)" $component 3 433 | } 434 | 435 | Add-TextToCMLog $LogFile "$component finished." $component 1 436 | Set-Location $OriginalLocation 437 | 438 | #Mark the last time the script ran. 439 | Get-Date | Out-File $lastRanPath -Force -WhatIf:$False -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SoftwareUpdateScripts 2 | 3 | A collection of scripts related to managing software updates via System Center Configuration Manager. 4 | 5 | ## Invoke-DGASoftwareUpdateMaintenance.ps1 6 | 7 | Can be used to maintain WSUS, software updates groups, ADRs, and deployment packages. Can also be used to work around certain deficiencies in ADR selection. 8 | 9 | https://damgoodadmin.com/2017/11/05/fully-automate-software-update-maintenance-in-cm/ 10 | 11 | ## Invoke-DGAAutomaticDeploymentRules.ps1 12 | 13 | Can be used to run an ADR only within 7 days of the last Patch Tuesday. This capability was built into Current Branch 1802. 14 | 15 | https://damgoodadmin.com/2017/11/13/patch-tuesday-is-a-lie/ 16 | 17 | ## Invoke-DGASoftwareUpdatePointSync.ps1 18 | 19 | Can be used to run a software update sync only within 7 days of the last Patch Tuesday. This capability was built into Current Branch 1802. 20 | 21 | https://damgoodadmin.com/2017/11/13/patch-tuesday-is-a-lie/ 22 | --------------------------------------------------------------------------------