Essa política atualiza a seguinte chave do Registro com vários valores:
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU
Name: UseWUServer
Type: DWORD
Value: 1
Name: WUServer
Type: String
Value: "URL to Windows Update Server"
Name: WUStatusServer
Type: String
Value: "URL to Intranet Statistics Server"
Basta definir esses valores usando o cmdlet Set-ItemProperty
:
# Set the values as needed
$WindowsUpdateRegKey = "HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU"
$WSUSServer = "https://10.101.10.10:5830"
$StatServer = "https://10.101.10.10:5830"
$Enabled = 1
# Test if the Registry Key doesn't exist already
if(-not (Test-Path $WindowsUpdateRegKey))
{
# Create the WindowsUpdate\AU key, since it doesn't exist already
# The -Force parameter will create any non-existing parent keys recursively
New-Item -Path $WindowsUpdateRegKey -Force
}
# Enable an Intranet-specific WSUS server
Set-ItemProperty -Path $WindowsUpdateRegKey -Name UseWUServer -Value $Enabled -Type DWord
# Specify the WSUS server
Set-ItemProperty -Path $WindowsUpdateRegKey -Name WUServer -Value $WSUSServer -Type String
# Specify the Statistics server
Set-ItemProperty -Path $WindowsUpdateRegKey -Name WUStatusServer -Value $StatServer -Type String
Talvez seja necessário reiniciar o serviço de atualização automática para que as alterações entrem em vigor
Restart-Service wuauserv -Force