Created
March 5, 2020 02:48
-
-
Save chalvorson/9a2a85382cf91efd6420f571c6847584 to your computer and use it in GitHub Desktop.
Approve list of updates for computer group on WSUS
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
[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