Windows Server Update Services (WSUS) Powershell Commands

From DFWLPiki
Jump to: navigation, search

General WSUS Server Maintennace

Run all WSUS clean up routines

Get-WsusServer | Invoke-WsusServerCleanup  -CleanupObsoleteComputers -CleanupObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates -DeclineExpiredUpdates -DeclineSupersededUpdates -Confirm:$false

Products Management

Add specific products to be syncronized

Get-WsusProduct -TitleIncludes "SQL"
Get-WsusProduct -TitleIncludes "Microsoft SQL Server 2017" | Set-WsusProduct -Verbose

Remove specific product from being syncronized

Get-WsusProduct -TitleIncludes "Microsoft SQL Server 2017" | Set-WsusProduct -Disable -Verbose

Invoke a synchronization

(Get-WsusServer).GetSubscription().StartSynchronization()