PeetersOnline.nl
Synchronize WSUS with Powershell
Yesterday, I showed you how to script the WSUS Cleanup Wizard with Powershell. Today, the WSUS fun continues! Here’s how to use powershell to “manually” synchronize your WSUS server, i.e. download the latest updates.
#Region VARIABLES # WSUS Connection Parameters: [String]$updateServer = "myWSUSServer.domain.local" [Boolean]$useSecureConnection = $False [Int32]$portNumber = 80 #EndRegion VARIABLES #Region SCRIPT # Load .NET assembly [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") # Connect to WSUS Server $Wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer,$useSecureConnection,$portNumber) # Perform Synchronization $Subscription = $Wsus.GetSubscription() $Subscription.StartSynchronization() #EndRegion SCRIPT |
Download the script here: Synchronize-Wsus (rename to .ps1)
Enjoy!
Hugo
No related posts.
5 Responses to Synchronize WSUS with Powershell
Tags
Active Directory API bind order cleanup cluster CPU Custom Fields datastores description device management directory tree errors Event Log file name filter Fun function HA IT known issues License Server LUN multipath NIC objects Oneliner portgroups PowerCLI PowerShell profile recursive Registry Scripts security session share snapshots SQL Stat VI Toolkit VMware vSphere WMI WSUS ZenArchives
- July 2012
- July 2011
- February 2011
- January 2011
- December 2010
- May 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008





Thanks for the sync script. One question. Does it sync with Microsoft or an upstream server?
Whichever you configured the server to sync with. It does the same thing as clicking on Synchronize Now in the WSUS console.
Hi,
I am seeking a way to sync computer in WSUS with AD OUs but no luck, do you think to make one script for that?…I’d love too but it seem out of my capability.
TIA.
Hi Chairuou,
I am not sure what you mean. If you configured GPO’s to assign computers to a specific WSUS group, the computers should automatically appear in the proper group in WSUS. You can force a computer to talk to WSUS by running: wuauclt /detectnow on the computer.
Hugo
thanks for the script! very handy for me