jjjjurb
jjjjurb

Reputation: 3

WSUS Replica sync updates with Microsoft Powershell

I'm trying to automate the configuration of a WSUS replica server. I'm mostly there but can't configure the option to download files from Microsoft Update.

I want my replica to pull updates from Microsoft and not from the upstream server. This is option in the UI:

WSUS Config

Had a look through GetConfiguration(), been have been unable to find the option. Also looked through the registry but can't see a key associated with the option.

Current code is:

Set-WsusServerSynchronization -UssServerName "SomeServer" -PortNumber 8530 -Replica

$WSUS = Get-Wsusserver
$WSUSConfig = $WSUS.GetConfiguration()
$WSUSConfig.ProxyName = $SomeProxy
$WSUSConfig.ProxyServerPort = $SomeProxy
$WSUSConfig.UseProxy = $True
$WSUSConfig.Save()

$Subscription = $WSUS.GetSubscription()
$Subscription.SynchronizeAutomatically = $true
$Subscription.SynchronizeAutomaticallyTimeOfDay = (New-TimeSpan -Hours 1)
$Subscription.NumberOfSynchronizationsPerDay = 1
$Subscription.Save()

Write-Host "Configured WSUS"

Upvotes: 0

Views: 943

Answers (2)

Aaron Ryan
Aaron Ryan

Reputation: 26

Could have used the powershell cmdlet again and just done the below to configure it to sync from Microsoft

Set-WsusServerSynchronization -SyncFromMU

Upvotes: 1

jjjjurb
jjjjurb

Reputation: 3

Answered my own question. For anyone else: $WSUSConfig.GetContentFromMU = $True

Upvotes: 0

Related Questions