Last active
August 31, 2022 18:32
-
-
Save nanoDBA/6dc0974d4ea7e275b5fb40df6cb6b545 to your computer and use it in GitHub Desktop.
Exclude SQL Server From Windows 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
<# DANGER - ***forced reboot(s) may occur*** #> | |
# $moduleName = "PSWindowsUpdate" | |
# if (Get-Module -ListAvailable -Name $moduleName) { | |
# Write-Output "$moduleName module is already installed." | Out-String | Write-Host -ForegroundColor Yellow | |
# Import-Module $moduleName | |
# } | |
# else { | |
# Write-Output "Module $moduleName is not installed - installing..." | Out-String | Write-Host -ForegroundColor Yellow | |
# $NuGetProvider = Get-PackageProvider -Name NuGet | Where-Object Version -GT 2.8.5.201; if ( -not $NuGetProvider) { Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Confirm:$false } | |
# <# Install moduleName #>Install-Module -Force $moduleName -Confirm:$false -Verbose | |
# Import-Module $moduleName | |
# } | |
<# DANGER - ***forced reboot(s) may occur*** #> | |
$paramHash = @{ | |
AcceptAll = $True | |
Install = $True | |
NotTitle = 'SQL' <# Exclude SQL Server From Windows Updates #> | |
Verbose = $True | |
# Modify next line as desired | |
RootCategories = 'Security Updates','Critical Updates', 'Definition Updates' #, 'Drivers' | |
AutoReboot = $True | |
# AutoReboot = $false | |
Confirm = $True | |
} | |
Get-WindowsUpdate @paramHash -ShowPreSearchCriteria -MicrosoftUpdate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment