1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| Dim WshShell
Dim strLogonServer
Dim fso
Dim f
Dim WSHProcess
Dim oFSO
Dim oFile
Dim oShell
'obtenir le logonserver
Set WshShell = Wscript.CreateObject("WScript.Shell")
strLogonServer = WshShell.ExpandEnvironmentStrings("%Logonserver%")
'msgbox strLogonServer
Set WSHProcess = WSHShell.Environment("Process")
'Positionner le logonserver dans une variable
DomainLogonServer = WSHProcess("LogonServer")
set oFSO = CreateObject("Scripting.FileSystemObject")
strFileName = oFSO.GetTempName
set oFile = oFSO.CreateTextFile(strFileName)
oFile.WriteLine "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUStatusServer [1 5 7 11 17]"
oFile.WriteLine "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\TargetGroup [1 5 7 11 17]"
oFile.Close
' Change registry permissions with regini.exe
'
set oShell = CreateObject("WScript.Shell")
oShell.Run "regini " & strFileName, 8, true
' Delete temp file
'
oFSO.DeleteFile strFileName
'modifier la valeur pour Wsus
DomainLogonServer = "http://" + right(strLogonServer,len(strLogonServer) - 2)
'msgbox DomainLogonServer
'Ecrire en registre
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUStatusServer", DomainLogonServer
'msgbox WshShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUStatusServer")
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUServer", DomainLogonServer
'msgbox WshShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\WUServer")
'msgbox DomainLogonServer
'Condition d'appartenance aux sites afin de renseigner le TargetGroup Wsus
Select case DomainLogonServer
Case "http://ServerName"
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\TargetGroup", "GroupeTest"
Case "http://ServerName1"
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\TargetGroup", "GroupeTest1"
End Select |
Partager