Voici un petit script PowerShell que j’ai fait afin de paramétrer automatiquement des clients pour se connecter à un serveur WSUS
# Create the RegKeys used by the computer to check the Update from your WSUS
# Author: KueiSaho
# Version: v1.0 - 21/03/2011
##########################################################################################################################################
#HELP on registry values
##########################################################################################################################################
#AUOptions Range = 2|3|4|5
#2 = Notify before download.
#3 = Automatically download and notify of installation.
#4 = Automatic download and scheduled installation. (Only valid if values exist for ScheduledInstallDay and ScheduledInstallTime.)
#5 = Automatic Updates is required, but end users can configure it.
#AutoInstallMinorUpdates Range = 0|1
#0 = Treat minor updates like other updates.
#1 = Silently install minor updates.
#DetectionFrequency Range=n; where n=time in hours (1-22).
#Time between detection cycles.
#DetectionFrequencyEnabled Range = 0|1
#1 = Enable DetectionFrequency.
#0 = Disable custom DetectionFrequency (use default value of 22 hours).
#NoAutoRebootWithLoggedOnUsers Range = 0|1;
#1 = Logged-on user gets to choose whether or not to restart his or her computer.
#0 = Automatic Updates notifies user that the computer will restart in 5 minutes.
#NoAutoUpdate Range = 0|1
#0 = Enable Automatic Updates.
#1 = Disable Automatic Updates.
#RebootRelaunchTimeout Range=n; where n=time in minutes (1-1440).
#Time between prompting again for a scheduled restart.
#RebootRelaunchTimeoutEnabled Range = 0|1
#1 = Enable RebootRelaunchTimeout.
#0 = Disable custom RebootRelaunchTimeout(use default value of 10 minutes).
#RebootWarningTimeout Range=n; where n=time in minutes (1-30).
#Length, in minutes, of the restart warning countdown after installing updates with a deadline or scheduled updates.
#RebootWarningTimeoutEnabled Range = 0|1
#1 = Enable RebootWarningTimeout.
#0 = Disable custom RebootWarningTimeout (use default value of 5 minutes).
#RescheduleWaitTime Range=n; where n=time in minutes (1-60).
#Time, in minutes, that Automatic Updates should wait at startup before applying updates from a missed scheduled installation time.
#Note that this policy applies only to scheduled installations, not deadlines. Updates whose deadlines have expired should always be installed as soon as possible.
#RescheduleWaitTimeEnabled Range = 0|1
#1 = Enable RescheduleWaitTime
#0 = Disable RescheduleWaitTime(attempt the missed installation during the next scheduled installation time).
#ScheduledInstallDay Range = 0|1|2|3|4|5|6|7
#0 = Every day.
#1 through 7 = The days of the week from Sunday (1) to Saturday (7).
#(Only valid if AUOptions equals 4.)
#ScheduledInstallTime Range = n; where n = the time of day in 24-hour format (0-23).
#UseWUServer The WUServer value is not respected unless this key is set.
##########################################################################################################################################
$WSUSServerURL = “http://10.0.1.1:8530”
$WindowsUpdateKey = test-path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate"
$WSUSAUOption = "4"
$WSUSDetectionFrequency = "16"
$WSUSDetectionFrequencyEnabled = "1"
$WSUSNoAutoUpdate = "0"
$WSUSScheduledInstallDay = "1"
$WSUSScheduledInstallTime = "3"
$WSUSUseWUServer = "1"
if($WindowsUpdateKey -eq $False)
{
Write-Host "Create the new Key WindowsUpdate"
$WindowsKey = New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate"
$WindowsKeyAU = New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU"
}
# Regenerate WSUSID
# Do not use
# Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\SusClientId" | Remove-ItemProperty -Force -WhatIf
# C:\WINDOWS\system32\wuauclt /resetauthorization /detectnow
# Create a key with the value:
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" -name "WUServer" -value $WSUSServerURL
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" -name "WUStatusServer" -value $WSUSServerURL
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" -name "AUOptions" -value $WSUSAUOptions
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" -name "DetectionFrequency" -value $WSUSDetectionFrequency
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" -name "DetectionFrequencyEnabled" -value $WSUSDetectionFrequencyEnabled
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" -name "NoAutoUpdate" -value $WSUSNoAutoUpdate
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" -name "ScheduledInstallDay" -value $WSUSScheduledInstallDay
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" -name "ScheduledInstallTime" -value $WSUSScheduledInstallTime
Set-ItemProperty -path "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" -name "UseWUServer" -value $WSUSUseWUServer
# Reload the Windows Update CLient configuration
sc stop wuauserv
sc start wuauserv
C:\WINDOWS\system32\wuauclt /detectnow
