Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###
- # Created by Matt Snead -- syntax53@gmail.com / http://www.twistedtek.net
- #
- # Ran with no switches on the local WSUS server (with mail server information entered below, and with matching group names),
- # this script will decline the specified updates, then approve specified updates, then do a cleanup (same as doing it from
- # the WSUS GUI). After that it will email lists of computers with failed updates and a list of updates that have been
- # failing to install. It will also email whenever new updates and classifications are found within 31 days.
- #
- # If you use Windows Defender you would want to comment out the 'DeclineUpdates -title "Windows Defender"'
- # and then UNcomment 'ApproveUpdates -class "Definition Updates" -group_name "All Computers" -action $approve_install -days_old 0'
- #
- # NOTE: INHERITANCE ASSUMED TO BE ENABLED FROM TOP > DOWN
- #
- # You can specify your smtp server, from/to addresses, WSUS groups, etc as switches, or specify them all below in the Param's section.
- #
- # Sample Usage: powershell.exe -ExecutionPolicy Unrestricted -nologo -NoProfile -File "D:\WSUS Scripts\WSUS Automation.ps1"
- #
- # Optional switches:
- # -UseSSL 0 or 1 : Defaults to No (0) -- SSL connection to WSUS server
- # -trialrun 0 or 1 : Defaults to No (0) -- 1 means no changes will be made. Simulate a regular run and send emails on what WOULD be done.
- # -emaillog 0 or 1 : Defaults to Yes (1) -- Send or Don't send emails.
- # -printlog 0 or 1 : Defaults to Yes (1) -- Print or don't print a lot of the results to console
- #
- # -skip_decline, -skip_approve, -skip_cleanup, -skip_lists : Skip various sections of the script (usually for testing only to speed things up)
- ##
- Param(
- [string]$WsusServer = ([system.net.dns]::GetHostByName('localhost')).hostname,
- [int]$PortNumber = 8530,
- [int]$UseSSL = 0,
- [string]$SMTPServer = "smtp_server.domain.name.com",
- [string]$From = "wsus@domain.name.com",
- [string]$To = "notifyuser@domain.name.com",
- [string]$Subject = "WSUS Automation",
- [string]$LIMBO_group = "Unassigned Computers",
- [string]$ASSIGNED_group = "Assigned",
- [string]$NORMAL_group = "Normal",
- [string]$FAST_DEPLOY_group = "Fast Deploy",
- [string]$SERVERS_group = "Servers",
- [int]$TrialRun = 0,
- [int]$EmailLog = 1,
- [int]$PrintLog = 1,
- [int]$important_update_days = 15,
- [int]$regular_update_days = 28,
- [int]$skip_decline = 0,
- [int]$skip_approve = 0,
- [int]$skip_cleanup = 0,
- [int]$skip_lists = 0
- )
- $TrialRun = [System.Convert]::ToBoolean($TrialRun)
- $EmailLog = [System.Convert]::ToBoolean($EmailLog)
- $PrintLog = [System.Convert]::ToBoolean($PrintLog)
- $UseSSL = [System.Convert]::ToBoolean($UseSSL)
- $skip_decline = [System.Convert]::ToBoolean($skip_decline)
- $skip_approve = [System.Convert]::ToBoolean($skip_approve)
- $skip_cleanup = [System.Convert]::ToBoolean($skip_cleanup)
- $skip_lists = [System.Convert]::ToBoolean($skip_lists)
- $Style = "<Style>BODY{font-size:12px;font-family:verdana,sans-serif;color:navy;font-weight:normal;}" + `
- "TABLE{border-width:1px;cellpadding=10;border-style:solid;border-color:navy;border-collapse:collapse;}" + `
- "TH{font-size:12px;border-width:1px;padding:10px;border-style:solid;border-color:navy;}" + `
- "TD{font-size:10px;border-width:1px;padding:10px;border-style:solid;border-color:navy;}</Style>"
- $Table = @{Name="Date";Expression={[string]$($_.CreationDate).ToShortDateString()}},`
- @{Name="Title";Expression={[string]$_.Title}},`
- @{Name="KB Article";Expression={[string]$_.KnowledgebaseArticles}},`
- @{Name="Classification";Expression={[string]$_.UpdateClassificationTitle}},`
- @{Name="Product Title";Expression={[string]$_.ProductTitles}},`
- @{Name="Product Family";Expression={[string]$_.ProductFamilyTitles}}
- $Table_Updates = @{Name="Date";Expression={[string]$($_.CreationDate).ToShortDateString()}},`
- @{Name="UpdateTitle";Expression={[string]$_.UpdateTitle}},`
- @{Name="Needed";Expression={[string]$_.NeededCount}},`
- @{Name="Installed";Expression={[string]$_.InstalledCount}},`
- @{Name="Failed";Expression={[string]$_.FailedCount}}
- $Table_Computers = @{Name="Computer";Expression={[string]$_.ComputerTarget}},`
- @{Name="Needed";Expression={[string]$_.NeededCount}},`
- @{Name="Failed";Expression={[string]$_.FailedCount}},`
- @{Name="Last";Expression={[string]$($_.LastReported).ToShortDateString()}}
- $Table_Print = @{Name="Title";Expression={[string]$_.Title}},`
- @{Name="Classification";Expression={[string]$_.UpdateClassificationTitle}}
- Write-Host ""
- If ($TrialRun) {
- Write-Host "Trial Run: YES"
- $Subject += " Trial Run"
- } else {
- Write-Host "Trial Run: NO"
- }
- Write-Host ""
- Function SendEmailStatus($From, $To, $Subject, $SMTPServer, $BodyAsHtml, $Body) {
- $SMTPMessage = New-Object System.Net.Mail.MailMessage $From, $To, $Subject, $Body
- $SMTPMessage.IsBodyHTML = $BodyAsHtml
- $SMTPClient = New-Object System.Net.Mail.SMTPClient $SMTPServer
- $SMTPClient.Send($SMTPMessage)
- If($? -eq $False){Write-Warning "$($Error[0].Exception.Message) | $($Error[0].Exception.GetBaseException().Message)"}
- $SMTPMessage.Dispose()
- rv SMTPClient
- rv SMTPMessage
- }
- Write-Host "Connecting to WSUS..."
- Write-Host ""
- #Connect to the WSUS interface.
- [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
- #Define the actions available for approving a patch
- $approve_all = [Microsoft.UpdateServices.Administration.UpdateApprovalAction]::All
- $approve_install = [Microsoft.UpdateServices.Administration.UpdateApprovalAction]::Install
- $approve_NotApproved = [Microsoft.UpdateServices.Administration.UpdateApprovalAction]::NotApproved
- $approve_Uninstall = [Microsoft.UpdateServices.Administration.UpdateApprovalAction]::Uninstall
- $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WsusServer,$UseSSL,$PortNumber);
- If ($? -eq $False) {
- Write-Warning "Something went wrong connecting to the WSUS interface on $WsusServer server: $($Error[0].Exception.Message)"
- If ($EmailLog) {
- $Body = ConvertTo-Html -head $Style -Body "Something went wrong connecting to the WSUS interface on $WsusServer server: $($Error[0].Exception.Message)" | Out-String
- $Body = $Body.Replace("<table>`r`n</table>", "")
- SendEmailStatus -From $From -To $To -Subject "$Subject - ERROR" -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- Exit
- }
- Function DeclineUpdates($title, $match_and) {
- if ($match_and) {
- Write-Host "Searching for '$title' && '$match_and' ..."
- } else {
- Write-Host "Searching for '$title' ..."
- }
- Write-Host ""
- $email_subject = "$Subject - Declined Updates :: $title"
- if ($match_and) { $email_subject += " $match_and" }
- $updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
- $updateScope.ApprovedStates = "Any"
- $updateScope.TextIncludes = $title
- if ($match_and) {
- $MatchedUpdates = $wsus.GetUpdates($updateScope) | ?{-not $_.IsDeclined -and $_.Title -match $title -and $_.Title -match $match_and}
- } else {
- $MatchedUpdates = $wsus.GetUpdates($updateScope) | ?{-not $_.IsDeclined -and $_.Title -match $title}
- }
- If($MatchedUpdates) {
- If ($TrialRun -eq $False) { $MatchedUpdates | %{$_.Decline()} }
- If ($EmailLog) {
- $email_subject += " (" + $MatchedUpdates.Count + ")"
- $Body = $MatchedUpdates | Select $Table | ConvertTo-HTML -head $Style
- SendEmailStatus -From $From -To $To -Subject $email_subject -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- If ($PrintLog) {
- $MatchedUpdates | Select $Table_Print | Format-List
- }
- } Else {
- Write-Host "No Matches."
- Write-Host ""
- }
- }
- Function GetListOfApprovedUpdates_WithInheritance($class, $group_name) {
- $list = New-Object System.Collections.ArrayList
- $group = $wsus.GetComputerTargetGroups() | ? {$_.Name -eq $group_name}
- If ([string]::IsNullOrEmpty($group)) { return $list }
- $classifications=$wsus.GetUpdateClassifications() | ?{$_.Title -eq $class}
- if ([string]::IsNullOrEmpty($classifications)) { return $list }
- $ApprovedUpdatesScope = new-object Microsoft.UpdateServices.Administration.UpdateScope
- $ApprovedUpdatesScope.ApprovedStates = "Any"
- $ApprovedUpdatesScope.Classifications.AddRange($classifications)
- $ret = $ApprovedUpdatesScope.ApprovedComputerTargetGroups.Add($group)
- $PrevApprovedUpdates = $wsus.GetUpdateApprovals($ApprovedUpdatesScope)
- foreach ($approval in $PrevApprovedUpdates) {
- $ret = $list.Add($wsus.GetUpdate($approval.UpdateID).ID.UpdateID)
- }
- Try {
- $parent = $group.GetParentTargetGroup().name
- if ($parent) {
- $list += GetListOfApprovedUpdates_WithInheritance -class $class -group_name $parent
- }
- } Catch {}
- return $list
- }
- Function ApproveUpdates($class, $group_name, $action, $days_old = 0, $title = "", $exclude_text = "", $exclude_title = "") {
- $days_old = [int]$days_old
- $email_subject = "$Subject - Approved $class / $group_name"
- if ($title -ne "") { $email_subject += " - $title" }
- Write-Host "Searching for computer group '$group_name' ..."
- $group = $wsus.GetComputerTargetGroups() | ? {$_.Name -eq $group_name}
- If ([string]::IsNullOrEmpty($group)) {
- Write-Host "Computer group '$group_name' not found!"
- Write-Host ""
- If ($EmailLog) {
- $email_subject += " (ERROR)"
- $Body = ConvertTo-Html -head $Style -Body "Computer group '$group_name' not found!" | Out-String
- $Body = $Body.Replace("<table>`r`n</table>", "")
- SendEmailStatus -From $From -To $To -Subject "$Subject - ERROR" -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- Return
- }
- Write-Host "Searching for $class ..."
- $classifications=$wsus.GetUpdateClassifications() | ?{$_.Title -eq $class}
- if ([string]::IsNullOrEmpty($classifications)) {
- Write-Host "Classification '$class' not found!"
- Write-Host ""
- If ($EmailLog) {
- $email_subject += " (ERROR)"
- $Body = ConvertTo-Html -head $Style -Body "Classification '$class' not found!" | Out-String
- $Body = $Body.Replace("<table>`r`n</table>", "")
- SendEmailStatus -From $From -To $To -Subject "$Subject - ERROR" -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- Return
- }
- Write-Host ""
- $approved_col = GetListOfApprovedUpdates_WithInheritance -class $class -group_name $group_name
- #$approved_col
- #$approved_col | Export-Csv "d:\approved_updates.csv" -NoTypeInformation -Encoding UTF8 -Delimiter ','
- $FilterUpdateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
- $FilterUpdateScope.ApprovedStates = "Any"
- $FilterUpdateScope.ToCreationDate = (Get-Date).AddDays(-$days_old)
- $ret = $FilterUpdateScope.Classifications.AddRange($classifications)
- if ($title) { $FilterUpdateScope.TextIncludes = $title }
- if ($exclude_text) { $FilterUpdateScope.TextNotIncludes = $exclude_text }
- $MatchedUpdates = $wsus.GetUpdates($FilterUpdateScope) | ?{-not $_.IsDeclined }
- if ($title) { $MatchedUpdates = $MatchedUpdates | ?{$_.Title -match $title} }
- if ($exclude_title) { $MatchedUpdates = $MatchedUpdates | ?{$_.Title -notmatch $exclude_title} }
- #$MatchedUpdates | Select $Table | Export-Csv "d:\matched_updates.csv" -NoTypeInformation -Encoding UTF8 -Delimiter ','
- If($MatchedUpdates) {
- $UpdatesCollection = New-Object Microsoft.UpdateServices.Administration.UpdateCollection
- Foreach ($update in $MatchedUpdates) {
- if ($approved_col -notcontains $update.ID.UpdateID) {
- If ($TrialRun -eq $False) {
- if ( -not $update.EulaAccepted ) { $ret = $update.AcceptEula() }
- if ( $update.RequiresLicenseAgreementAcceptance ) {
- $eula = $update.GetLicenseAgreement()
- $ret = $update.AcceptLicenseAgreement()
- }
- $ret = $update.Approve($action,$group)
- }
- $ret = $UpdatesCollection.Add($update)
- }
- }
- if ($UpdatesCollection.Count -gt 0) {
- If ($EmailLog) {
- $email_subject += " (" + $UpdatesCollection.Count + ")"
- $Body = $UpdatesCollection | Select $Table | ConvertTo-HTML -head $Style
- SendEmailStatus -From $From -To $To -Subject $email_subject -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- If ($PrintLog) {
- $UpdatesCollection | Select $Table_Print | Format-List
- Write-Host "Total:" $UpdatesCollection.Count
- Write-Host ""
- }
- } else {
- Write-Host "No Updates to Approve."
- Write-Host ""
- }
- } Else {
- Write-Host "No Matches."
- Write-Host ""
- }
- }
- Function DoCleanup() {
- Write-Host "Executing Cleanup..."
- $CleanupScopeObject = New-Object Microsoft.UpdateServices.Administration.CleanupScope
- $CleanupScopeObject.CleanupObsoleteComputers = $True
- $CleanupScopeObject.CleanupObsoleteUpdates = $True
- $CleanupScopeObject.CleanupUnneededContentFiles = $True
- $CleanupScopeObject.CompressUpdates = $True
- $CleanupScopeObject.DeclineExpiredUpdates = $True
- $CleanupScopeObject.DeclineSupersededUpdates = $True
- $CleanupTASK = $wsus.GetCleanupManager()
- $Results = $CleanupTASK.PerformCleanup($CleanupScopeObject)
- $changes = $Results.SupersededUpdatesDeclined + $Results.ExpiredUpdatesDeclined + $Results.ObsoleteUpdatesDeleted + $Results.UpdatesCompressed + $Results.ObsoleteComputersDeleted + $Results.DiskSpaceFreed
- if ($changes) {
- $DObject = New-Object PSObject
- $DObject | Add-Member -MemberType NoteProperty -Name "Superseded Declined" -Value $Results.SupersededUpdatesDeclined
- $DObject | Add-Member -MemberType NoteProperty -Name "Expired Declined" -Value $Results.ExpiredUpdatesDeclined
- $DObject | Add-Member -MemberType NoteProperty -Name "Updates Deleted" -Value $Results.ObsoleteUpdatesDeleted
- $DObject | Add-Member -MemberType NoteProperty -Name "Revisions Deleted" -Value $Results.UpdatesCompressed
- $DObject | Add-Member -MemberType NoteProperty -Name "Computers Deleted" -Value $Results.ObsoleteComputersDeleted
- $DObject | Add-Member -MemberType NoteProperty -Name "Disk Space Freed" -Value $Results.DiskSpaceFreed.ToString('N0')
- If ($EmailLog) {
- $Body = $DObject | ConvertTo-Html -Head $Style
- SendEmailStatus -From $From -To $To -Subject "$Subject - Cleanup Report" -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- If ($PrintLog) {
- $DObject | Format-Table
- }
- } else {
- Write-Host "Nothing to clean."
- Write-Host ""
- }
- }
- Function ListFailedComputers($days_old = 5) {
- $computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope
- $computerscope.FromLastReportedStatusTime = (Get-Date).AddDays(-$days_old)
- $updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
- $updatescope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::Failed
- $updatescope.ApprovedStates = "Any"
- $updatescope.FromArrivalDate = (Get-Date).AddDays(-730)
- $fails = $wsus.GetSummariesPerComputerTarget($updatescope,$computerscope)
- if ($fails.Count -lt 1) { Return }
- $FailedComputers = New-Object Microsoft.UpdateServices.Administration.UpdateSummaryCollection
- foreach ($fail in $fails) {
- if (($fail.DownloadedCount + $fail.NotInstalledCount) -gt 0 -and $fail.FailedCount -gt 0) {
- $ret = $FailedComputers.Add($fail)
- #$fail | Format-Table
- }
- }
- if ($FailedComputers.Count -lt 1) { Return }
- $result = $FailedComputers | Select @{L='ComputerTarget';E={($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName}},@{L='LastReported';E={($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).LastReportedStatusTime}},@{L='NeededCount';E={($_.DownloadedCount + $_.NotInstalledCount)}},FailedCount | Sort-Object FailedCount -descending | Select $Table_Computers
- If ($EmailLog) {
- $Body = $result | ConvertTo-Html -Head $Style
- SendEmailStatus -From $From -To $To -Subject ("$Subject - Failed Computers (" + $FailedComputers.Count + ")") -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- If ($PrintLog) {
- $result
- }
- }
- Function ListFailedUpdates() {
- $updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
- $computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope
- $updatescope.IncludedInstallationStates = [Microsoft.UpdateServices.Administration.UpdateInstallationStates]::Failed
- $updatescope.ApprovedStates = "Any"
- $updatescope.FromArrivalDate = (Get-Date).AddDays(-730)
- $fails = $wsus.GetSummariesPerUpdate($updatescope,$computerscope)
- if ($fails.Count -lt 1) { Return }
- $FailedUpdates = New-Object Microsoft.UpdateServices.Administration.UpdateSummaryCollection
- foreach ($fail in $fails) {
- #if (($fail.DownloadedCount + $fail.NotInstalledCount) -gt 4 -and $fail.FailedCount -gt (($fail.DownloadedCount + $fail.NotInstalledCount)/2) -and $fail.FailedCount -ge $fail.InstalledCount) {
- if (($fail.DownloadedCount + $fail.NotInstalledCount) -gt 4 -and $fail.FailedCount -gt (($fail.DownloadedCount + $fail.NotInstalledCount)/2)) {
- $update = $wsus.GetUpdate([guid]$fail.UpdateId)
- if ($update) {
- if ($update.IsDeclined -eq $False -and $update.IsApproved -eq $True) {
- $ret = $FailedUpdates.Add($fail)
- #$fail | Format-Table
- }
- }
- }
- }
- if ($FailedUpdates.Count -lt 1) { Return }
- $result = $FailedUpdates | Select @{L='UpdateTitle';E={($wsus.GetUpdate([guid]$_.UpdateId)).Title}}, @{L='CreationDate';E={($wsus.GetUpdate([guid]$_.UpdateId)).CreationDate}}, @{L='NeededCount';E={($_.DownloadedCount + $_.NotInstalledCount)}},InstalledCount,FailedCount | Sort-Object FailedCount -descending | Select $Table_Updates
- If ($EmailLog) {
- $Body = $result | ConvertTo-Html -Head $Style
- SendEmailStatus -From $From -To $To -Subject ("$Subject - Failed Updates (" + $FailedUpdates.Count + ")") -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- If ($PrintLog) {
- $result
- }
- }
- Function GetNewProductsClassifications() {
- $days_back = 31
- $new_products = $wsus.GetUpdateCategories((Get-Date).AddDays(-$days_back),(Get-Date)) | select Title, Description, arrivaldate
- $new_classifications = $wsus.GetUpdateClassifications((Get-Date).AddDays(-$days_back),(Get-Date)) | select Title, Description, arrivaldate
- if ($new_products.count -gt 0 -or $new_classifications.count -gt 0) {
- If ($EmailLog) {
- $latest_date = Get-Date -Year 2000 -Month 1 -Day 1
- foreach ($obj in $new_products) {
- if ($obj.ArrivalDate -gt $latest_date) { $latest_date = $obj.ArrivalDate }
- }
- foreach ($obj in $new_classifications) {
- if ($obj.ArrivalDate -gt $latest_date) { $latest_date = $obj.ArrivalDate }
- }
- $email_subject = "$Subject - New Products / Classifications (" + $latest_date.ToString("MM/dd/yyyy") + ")"
- $Body = ""
- $nohead = 0
- if ([string]::IsNullOrEmpty($new_classifications) -eq $false) {
- $Body += "<strong>New Classifications:</strong><br><br>" + ($new_classifications | ConvertTo-Html -Head $Style) + "<br><br>"
- $nohead = 1
- }
- if ([string]::IsNullOrEmpty($new_products) -eq $false) {
- if ($nohead) {
- $Body += "<strong>New Products:</strong><br><br>" + ($new_products | ConvertTo-Html) + "<br><br>"
- } else {
- $Body += "<strong>New Products:</strong><br><br>" + ($new_products | ConvertTo-Html -Head $Style) + "<br><br>"
- }
- }
- SendEmailStatus -From $From -To $To -Subject $email_subject -SmtpServer $SmtpServer -BodyAsHtml $True -Body $Body
- }
- If ($PrintLog) {
- if ([string]::IsNullOrEmpty($new_products) -eq $false) { $new_products | Format-List }
- if ([string]::IsNullOrEmpty($new_classifications) -eq $false) { $new_classifications | Format-List }
- }
- } else {
- If ($PrintLog) {
- Write-Host "No new products or classifications."
- Write-Host ""
- }
- }
- }
- if (-not $skip_decline) {
- DeclineUpdates -title "Microsoft Office" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft Word" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft Excel" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft PowerPoint" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft Access" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft Publisher" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft Project" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft Outlook" -match_and "64-Bit"
- DeclineUpdates -title "Microsoft OneNote"
- DeclineUpdates -title "Microsoft InfoPath"
- DeclineUpdates -title "Microsoft Lync"
- DeclineUpdates -title "ia64"
- DeclineUpdates -title "itanium"
- DeclineUpdates -title "Windows 10 Insider"
- DeclineUpdates -title " beta"
- DeclineUpdates -title "Multilingual User Interface"
- DeclineUpdates -title "Lang Pack"
- DeclineUpdates -title "Language Packs"
- DeclineUpdates -title "LanguageFeature"
- DeclineUpdates -title "Language Interface Pack"
- DeclineUpdates -title "Web Apps Server"
- DeclineUpdates -title "SharePoint"
- DeclineUpdates -title "Microsoft Business"
- DeclineUpdates -title "Skype for Business"
- DeclineUpdates -title "OneDrive for Business"
- DeclineUpdates -title "Preview of"
- DeclineUpdates -title "Windows Defender"
- }
- if (-not $skip_approve) {
- #ApproveUpdates -class "Definition Updates" -group_name "All Computers" -action $approve_install -days_old 0
- ApproveUpdates -class "Security Updates" -group_name "All Computers" -action $approve_install -days_old 0 -title "Flash Player"
- ApproveUpdates -class "Critical Updates" -group_name "All Computers" -action $approve_install -days_old 0 -title "Flash Player"
- ApproveUpdates -class "Updates" -group_name "All Computers" -action $approve_install -days_old 0 -title "Flash Player"
- ApproveUpdates -class "Security Updates" -group_name $FAST_DEPLOY_group -action $approve_install -days_old 0
- ApproveUpdates -class "Security Updates" -group_name $ASSIGNED_group -action $approve_install -days_old $important_update_days -exclude_text "Security Monthly Quality Rollup" -exclude_title "Preview of"
- ApproveUpdates -class "Security Updates" -group_name $LIMBO_group -action $approve_install -days_old $important_update_days -exclude_text "Security Monthly Quality Rollup" -exclude_title "Preview of"
- ApproveUpdates -class "Critical Updates" -group_name $FAST_DEPLOY_group -action $approve_install -days_old 0
- ApproveUpdates -class "Critical Updates" -group_name $NORMAL_group -action $approve_install -days_old $important_update_days
- ApproveUpdates -class "Critical Updates" -group_name $LIMBO_group -action $approve_install -days_old $important_update_days
- ApproveUpdates -class "Critical Updates" -group_name $SERVERS_group -action $approve_install -days_old $regular_update_days
- ApproveUpdates -class "Updates" -group_name $FAST_DEPLOY_group -action $approve_install -days_old 0
- ApproveUpdates -class "Updates" -group_name $NORMAL_group -action $approve_install -days_old $regular_update_days -exclude_title "Preview of"
- ApproveUpdates -class "Updates" -group_name $LIMBO_group -action $approve_install -days_old $regular_update_days -exclude_title "Preview of"
- ApproveUpdates -class "Updates" -group_name $SERVERS_group -action $approve_install -days_old ($regular_update_days * 2) -exclude_title "Preview of"
- ApproveUpdates -class "Update Rollups" -group_name $FAST_DEPLOY_group -action $approve_install -days_old 0
- ApproveUpdates -class "Update Rollups" -group_name $NORMAL_group -action $approve_install -days_old $regular_update_days
- ApproveUpdates -class "Update Rollups" -group_name $LIMBO_group -action $approve_install -days_old $regular_update_days
- ApproveUpdates -class "Update Rollups" -group_name $SERVERS_group -action $approve_install -days_old ($regular_update_days * 2)
- ApproveUpdates -class "Service Packs" -group_name $FAST_DEPLOY_group -action $approve_install -days_old 0
- ApproveUpdates -class "Service Packs" -group_name $NORMAL_group -action $approve_install -days_old $regular_update_days
- ApproveUpdates -class "Service Packs" -group_name $LIMBO_group -action $approve_install -days_old $regular_update_days
- ApproveUpdates -class "Service Packs" -group_name $SERVERS_group -action $approve_install -days_old ($regular_update_days * 2)
- }
- If ($TrialRun -eq $False -and -not $skip_cleanup) { DoCleanup }
- if (-not $skip_lists) {
- ListFailedUpdates
- ListFailedComputers
- GetNewProductsClassifications
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement