Last active
December 19, 2015 21:29
-
-
Save buckelij/6020649 to your computer and use it in GitHub Desktop.
Diff against 'Windows Update PowerShell Module' to install only 'important' updates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Has been incorporated upstream | |
#Diff against 'Windows Update PowerShell Module' by MichalGajda | |
#Install updates that would appear as 'import' in Windows Update Gui. | |
#(http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/) | |
#http://gallery.technet.microsoft.com/scriptcenter/Add-Parameter-AutoSelectOnl-1d62a499 | |
# diff -u Get-WUInstall.ps1.orig PSWindowsUpdate/Get-WUInstall.ps1 | |
--- Get-WUInstall.ps1.orig | |
+++ PSWindowsUpdate/Get-WUInstall.ps1 | |
@@ -87,6 +87,9 @@ | |
.PARAMETER IgnoreReboot | |
Do not ask for reboot if it needed, but do not reboot automaticaly. | |
+ .PARAMETER AutoSelectOnly | |
+ Install only the updates that would appear as 'important' updates in the Windows Update GUI. | |
+ | |
.PARAMETER Debuger | |
Debug mode. | |
@@ -232,6 +235,7 @@ | |
[Switch]$AcceptAll, | |
[Switch]$AutoReboot, | |
[Switch]$IgnoreReboot, | |
+ [Switch]$AutoSelectOnly, | |
[Switch]$Debuger | |
) | |
@@ -696,6 +700,25 @@ | |
Write-Debug "Add update to collection" | |
$objCollectionChoose.Add($Update) | Out-Null | |
} #End If $AcceptAll | |
+ ElseIf($AutoSelectOnly) | |
+ { | |
+ If($Update.AutoSelectOnWebsites) | |
+ { | |
+ $Status = "Accepted" | |
+ If($Update.EulaAccepted -eq 0) | |
+ { | |
+ Write-Debug "Accept Eula" | |
+ $Update.AcceptEula() | |
+ } #End If $Update.EulaAccepted -eq 0 | |
+ | |
+ Write-Debug "Add update to collection" | |
+ $objCollectionChoose.Add($Update) | Out-Null | |
+ } | |
+ Else | |
+ { | |
+ $Status = "Rejected" | |
+ } | |
+ } #End Else If $AutoSelectOnly | |
Else | |
{ | |
If($pscmdlet.ShouldProcess($Env:COMPUTERNAME,"$($Update.Title)[$size]?")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment