Set WshNetwork = WScript.CreateObject("WScript.Network") Set WshShell = WScript.CreateObject("WScript.Shell") Set WshSysEnv = WshShell.Environment("SYSTEM") Public vbyes,Vbno, vbOk, vbCancel, IPConf, Amon vbyes=6 vbno=7 vbOk=1 vbCancel=2 IPConf=0 Amon=MsgBox("Cette station est-elle derrière un serveur AMON ?",35,"Configuration station - Académie de Créteil") IF Amon <>2 THEN result=MsgBox("Voulez-vous configurer automatiquement le proxy Internet Explorer ?",36, "Internet Explorer - Académie de Créteil") Call proxy(result) result=MsgBox("Voulez-vous inscrire le site intraetab comme page d'accueil d'Internet Explorer ",36, "Page d'accueil - Académie de Créteil") Call intraetab(result) result=MsgBox("Voulez-vous que les fenêtres de publicités intempestives soient bloquées sur ce poste ?",36, "POPUP - Académie de Créteil") Call popup(result) result=MsgBox("Voulez-vous inscrire le site Trend24 dans la zone Intranet locale d'Internet Explorer ",36, "Internet Explorer - Académie de Créteil") Call trend24(result) result=MsgBox("Voulez-vous désactiver le pare-feu Windows sur ce poste ?",36, "Firewall - Académie de Créteil") Call firewall(result) result=MsgBox("Voulez-vous configurer ce poste pour une mise à jour automatique ?",36, "Windows Update - Académie de Créteil") Call wuau(result) result=MsgBox("Voulez-vous modifier l'adresse IP du poste ?",36, "Configuration réseau - Académie de Créteil") Call Config_ip(result) IF IPConf=0 THEN result=MsgBox("Voulez-vous modifier l'adresse DNS du poste ?",36, "Configuration réseau - Académie de Créteil") Call Change_dns(result) END IF FIN=MsgBox("Configuration terminée",64, "Académie de Créteil") END IF Private sub proxy (rep) IF rep=vbyes THEN IF Amon=vbyes THEN WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL", "http://diff.ac-creteil.fr/proxyamon.pac", "REG_SZ" ELSEIF Amon=vbno THEN WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL", "http://intra.in.ac-creteil.fr/proxy.pac", "REG_SZ" END IF END IF End sub Private sub intraetab (rep) IF rep=vbyes THEN WshShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page", "http://intraetab.in.ac-creteil.fr", "REG_SZ" END IF End Sub Private sub popup(rep) IF rep=vbyes THEN WshShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\New Windows\PopupMgr", "yes", "REG_SZ" ELSEIF rep=vbno THEN WshShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\New Windows\PopupMgr", "no", "REG_SZ" ELSE END IF END SUB Private sub trend24(rep) IF rep=vbyes THEN WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\ac-creteil.fr\trend24.in\http", "1" , "REG_DWORD" ELSE WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\ac-creteil.fr\trend24.in\http", "0" , "REG_DWORD" END IF END Sub Private sub firewall(rep) Set objFirewall = CreateObject("HNetCfg.FwMgr") Set objPolicy = objFirewall.LocalPolicy.CurrentProfile IF rep=vbyes THEN objPolicy.FirewallEnabled = FALSE ELSE objPolicy.FirewallEnabled = TRUE END IF END sub Private sub wuau(rep) IF rep=vbyes THEN WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\ElevateNonAdmins", "0", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\AUOptions", "4", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoUpdate", "0", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAUAsDefaultShutdownOption", "1", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAUShutdownOption", "0", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoRebootWithLoggedOnUsers", "1", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoUpdate", "0", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\RebootRelaunchTimeoutEnabled", "0", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\RescheduleWaitTime", "15", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\RescheduleWaitTimeEnabled", "1", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\ScheduledInstallTime", "8", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\ScheduledInstallDay", "0", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\WaitTime", "15", "REG_DWORD" WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU\RebootRelaunchTimeoutEnabled", "0", "REG_DWORD" END IF END sub Private sub Config_ip(rep) Env=WshSysEnv("OS") IF Env="Windows_NT" THEN IF rep=vbyes THEN INTERFACE=inputbox("Interface","Configuration IP - Académie de Créteil","Connexion au réseau local") IF INTERFACE="" THEN Exit sub END IF add_ip=InputBox("Entrer l'adresse ip","Configuration IP - Académie de Créteil","10.") IF add_ip="" THEN Exit sub END IF mask="255.255.255.128" temp=add_ip add_gw=add_res(temp)&"1" temp=add_ip IF Amon=vbyes THEN add_dns=add_res(temp)&"1" ELSE add_dns="192.168.74.129" END IF commande1= "netsh interface ip set address """&INTERFACE&""" static "&add_ip&" "&mask&" "&add_gw&" 1" commande2= "netsh interface ip set dns """&INTERFACE&""" static "&add_dns IPConf=1 return=WshShell.Run(commande1, 1, true) return=WshShell.Run(commande2, 1, true) WshShell.RegWrite "HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters\SearchList" , "in.ac-creteil.fr" , "REG_SZ" END IF ELSEIF Env<>"Windows_NT" THEN fin=MsgBox("Ce script n'est utilisable que sur des OS de technologie NT",16, "Configuration IP - Académie de Créteil") END IF END SUB Private sub Change_dns(rep) Env=WshSysEnv("OS") IF Env="Windows_NT" THEN IF rep=vbyes THEN INTERFACE=inputbox("Interface","Configuration IP - Académie de Créteil","Connexion au réseau local") IF INTERFACE="" THEN Exit sub END IF add_ip=InputBox("Entrer l'adresse ip du réseau administratif de l'établissement","Configuration DNS - Académie de Créteil","10.") IF add_ip="" THEN Exit sub END IF temp=add_ip IF Amon=vbyes THEN add_dns=add_res(temp)&"1" ELSE add_dns="192.168.74.129" END IF commande= "netsh interface ip set dns """&INTERFACE&""" static "&add_dns return=WshShell.Run(commande, 1, true) WshShell.RegWrite "HKLM\SYSTEM\ControlSet001\Services\Tcpip\Parameters\SearchList" , "in.ac-creteil.fr" , "REG_SZ" END IF ELSEIF Env<>"Windows_NT" THEN fin=MsgBox("Ce script n'est utilisable que sur des OS de technologie NT",16, "Configuration DNS - Académie de Créteil") END IF END SUB Private function add_res(ip) Do ip=Mid(ip,1,Len(ip)-1) Loop Until Right(ip,1)="." add_res=ip End function