<# .SYNOPSIS Configuration WSUS avec la fonction infosEtab .DESCRIPTION La fonction Get-InfosEtab récupère l'adresse IP du serveur WSUS en utilisant la résolution de nom DNS. Le paramètre <-verbose> indique des informations supplémentaires. .PARAMETER chaine de caractère définissant le nom du serveur WSUS. .EXAMPLE $InfosEtab.NumLyc .NOTES Auteurs : Patrick Pattyn et Aurélien Hamez - UTIL Secteur 2 Région Hauts de France #> $InfoEtab = Get-InfosEtab [int]$NumRxLyc = $InfoEtab.NumRxLyc # On teste si le NumLyc à besoin d'un 0 ou de deux if( $NumRxLyc -ge '100') { Write-Host "Le script continue" $TargetGroup = 'LYC-' + $NumRxLyc } elseif( $NumRxLyc -ge '10' -and $NumRxLyc -le '99') { $TargetGroup = 'LYC-0' + $NumRxLyc } else { $TargetGroup = 'LYC-00' + $NumRxLyc } $AdressServeurWSUS = "http://" + $InfoEtab.DSSIP + ":8530" Write-Host Configuration de Windows Update en cours. $Key = "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate" if( -Not ( Test-Path "Registry::$Key")) { New-Item -Path $Key -ItemType RegistryKey -Force } New-ItemProperty $Key -Name “TargetGroup” -Type "String" -Value $TargetGroup -Force New-ItemProperty $Key -Name “TargetGroupEnabled” -Type DWORD -Value 1 -Force New-ItemProperty $Key -Name “WUServer” -Type "String" -Value $AdressServeurWSUS -Force New-ItemProperty $Key -Name “WUStatusServer” -Type "String" -Value $AdressServeurWSUS -Force New-ItemProperty $Key -Name “ElevateNonAdmins” -Type DWORD -Value 1 -Force New-ItemProperty $Key -Name “AcceptTrustedPublisherCerts” -Type DWORD -Value 1 -Force New-ItemProperty $Key -Name “DisableWindowsUpdateAccess” -Type DWORD -Value 1 -Force $KeyAU = "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate\AU" if( -Not ( Test-Path "Registry::$Key")) { New-Item -Path $KeyAU -ItemType RegistryKey -Force } New-ItemProperty $KeyAU -Name “NoAutoRebootWithLoggedOnUsers” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “RebootRelaunchTimeoutEnabled” -Type DWORD -Value 0 -Force New-ItemProperty $KeyAU -Name “RebootWarningTimeoutEnabled” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “RescheduleWaitTimeEnabled” -Type DWORD -Value 0 -Force New-ItemProperty $KeyAU -Name “AutoInstallMinorUpdates” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “DetectionFrequencyEnabled” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “DetectionFrequency” -Type DWORD -Value 2 -Force New-ItemProperty $KeyAU -Name “UseWUServer” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “AUPowerManagement” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “NoAUAsDefaultShutdownOption” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “NoAUShutdownOption” -Type DWORD -Value 0 -Force New-ItemProperty $KeyAU -Name “RebootRelaunchTimeout” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “ScheduledInstallDay” -Type DWORD -Value 0 -Force New-ItemProperty $KeyAU -Name “ScheduledInstallTime” -Type DWORD -Value 12 -Force New-ItemProperty $KeyAU -Name “RebootWarningTimeout” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “RescheduleWaitTime” -Type DWORD -Value 1 -Force New-ItemProperty $KeyAU -Name “AUOptions” -Type DWORD -Value 4 -Force # Forcer le client à contacter le serveur WSUS Wuauclt /detectnow