Skip to content

Instantly share code, notes, and snippets.

@chalvorson
Created March 5, 2020 02:48
Show Gist options
  • Save chalvorson/9a2a85382cf91efd6420f571c6847584 to your computer and use it in GitHub Desktop.
Save chalvorson/9a2a85382cf91efd6420f571c6847584 to your computer and use it in GitHub Desktop.
Approve list of updates for computer group on WSUS
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,
Position=0)]
[string]
$WsusServer,
[int]
$Port = "80",
[Parameter(Mandatory=$true)]
[ValidateScript({Test-Path $_ -PathType 'Leaf'})]
[string]
$ApprovedUpdateFile,
[Parameter(Mandatory=$true)]
[string]
$WSUSGroup
)
# Prerequisite: Install-Module PoshWSUS
# Usage: .\WSUS-ApproveUpdatesFromFile.ps1 -WsusServer localhost -Port 8530 -WSUSGroup "FactoryTalk" -ApprovedUpdateFile .\FactoryTalk.updates
Import-Module PoshWSUS
Connect-PSWSUSServer -WsusServer $WsusServer -port $Port
$ComputerGroup = Get-PSWSUSGroup -Name $WSUSGroup
Get-Content $ApprovedUpdateFile | ForEach-Object {
Get-PSWSUSUpdate $_ | Approve-PSWSUSUpdate -Action Install -Group $ComputerGroup -PassThru
}
Disconnect-PSWSUSServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment