WSUS pour Poste local

Forcer WSUS pour les postes hors domaine :

Pour ceBox®, il est intéressant de connaitre cette astuce.
Dans le cas d'un parc où les mises à jour de Windows sont gérés par un serveur WSUS, il faut pouvoir préciser celui-ci.

Dans les "best practice" ceBox®, il faut laisser les scripts d'intégration au domaine se jouer après le déploiement des VM.

Dans la pratique rien de très compliqué, il vous suffit d'ajouter les clés de registre suivantes sur la Version du Master de Windows :

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
"WUServer"="http://192.168.0.x"
"WUStatusServer"="http://192.168.0.x"

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU]
"UseWUServer"=dword:00000001
"IncludeRecommendedUpdates"=dword:00000001
"NoAutoUpdate"=dword:00000000
"AUOptions"=dword:00000002
"ScheduledInstallDay"=dword:00000000
"ScheduledInstallTime"=dword:00000010

Il est effectivement laborieux de faire cela manuellement, donc je vous propose le script suivant :

###############################################     ##     ## 
############# WSUS hors domaine : #############      ##   ##
###############################################     #########
                                                   ### ### ###
                                                 ###############
                                                ## ########### ##
                                                ## ##       ## ##
                                                 #  #### ####  #
                                                 
# Assemblies #

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Win32")
# Assemblies #

# Functions #

# WindowsUpdate #


do {
Read-Host "Quelle est l'ip ou le nom DNS du WSUS ? `n" -OutVariable wsus | Out-Null
}
while (!$wsus)

Read-Host "Quelle est le port d'utilisation du WSUS ? (si laissé, port par défaut 8530 ) `n" -OutVariable wsusport | Out-Null

if (!$wsusport){
    $wsusport = 8530
}

$RegLocalMachine = "SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"

$reg = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey( $RegLocalMachine, "true" )

$reg.SetValue( "WUServer", "http://$wsus`:$wsusport", [Microsoft.Win32.RegistryValueKind]::String)
$reg.SetValue( "WUStatusServer", "http://$wsus`:$wsusport", [Microsoft.Win32.RegistryValueKind]::String)
$reg.Close()
# WindowsUpdate #

# WindowsUpdateAU #

$RegLocalMachine = "SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"

$reg1 = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey( $RegLocalMachine, "true" )

$reg1.SetValue( "UseWUServer", "1", [Microsoft.Win32.RegistryValueKind]::DWord)
$reg1.SetValue( "IncludeRecommendedUpdates", "1", [Microsoft.Win32.RegistryValueKind]::DWord)
$reg1.SetValue( "NoAutoUpdate", "0", [Microsoft.Win32.RegistryValueKind]::DWord)
$reg1.SetValue( "AUOptions", "2", [Microsoft.Win32.RegistryValueKind]::DWord)
$reg1.SetValue( "ScheduledInstallDay", "0", [Microsoft.Win32.RegistryValueKind]::DWord)
$reg1.SetValue( "ScheduledInstallTime", "10", [Microsoft.Win32.RegistryValueKind]::DWord)
$reg1.Close()

# WindowsUpdateAU #
###############################################    ### #  # #
############# WSUS hors domaine : #############    ##  #  #\#
###############################################    #   #  # #

Il ne vous reste plus qu'à vérifier dans "regedit.exe" ou en lançant une mise à jour.