Citation :
voila, je dois faire un script en VBS. son role :
- detecter la version de windows
- si pas xp sp2 rien
- si xp sp2 alors lance un fichier.reg pour modifier la base de registre de la machine
deja est ce faisable??? je n'y connais rien en vbs, et j'ai rien trouvé pour la version de windows...
une idée??
please help...
|
Voila le prog final, y a t'il des aberation??
'/--------------------------------------------------------\
'Script VBS
'Verifie la presence de Windows XP SP2 puis modifie la BDR
'\--------------------------------------------------------/
Dim OS
Dim SP2
Set WshShell = CreateObject("Wscript.Shell" )
On Error Resume Next
OS = ""'pour etre sur que la variable est vide
OS =WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" )
SP2 = ""
SP2 = WSHShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion" )
If OS = "Microsoft Windows XP" and SP2 ="Service Pack 2" Then
Msgbox "OS ok - SP2 ok"
Set WshShell = CreateObject("Wscript.Shell" )
'----------------------------------------------------------
'Permet l'administration à distance de eTrust Antivirus 7
'----------------------------------------------------------
valeur1 = "" 'pour etre sur que la variable est vide
valeur1 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\RPC\restrictremoteclients" )
Msgbox "lecture ok"
If valeur1 <> "0" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\RPC\restrictremoteclients", 0, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Désactive le centre de sécurité
'----------------------------------------------------------
valeur2 = ""
valeur2 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc\Start" )
If valeur2 <> "4" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc\Start", 4, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Supprime les info-bulles de notification d'impression
'----------------------------------------------------------
valeur3 = ""
valeur3 = WshShell.RegRead("HKEY_CURRENT_USER\Printers\Settings\EnableBalloonNotificationsLocal" )
If valeur3 <> "0" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_CURRENT_USER\Printers\Settings\EnableBalloonNotificationsLocal", 0, "REG_DWORD" 'clé Dword
valeur4 = ""
valeur4 = WshShell.RegRead("HKEY_CURRENT_USER\Printers\Settings\EnableBalloonNotificationsRemote" )
If valeur4 <> "0" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_CURRENT_USER\Printers\Settings\EnableBalloonNotificationsRemote", 0, "REG_DWORD" 'clé Dword
End If
End If
'----------------------------------------------------------
'Désactive le partage de connexion et le firewall
'----------------------------------------------------------
valeur5 = ""
valeur5 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Start" )
If valeur5 <> "4" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Start", 4, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Démarrage manuel du service d'aide et support à distance
'----------------------------------------------------------
valeur6 = ""
valeur6 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\helpsvc\Start" )
If valeur6 <> "2" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\helpsvc\Start", 2, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Démarrage manuel du service de mise à jour de Windows
'----------------------------------------------------------
valeur7 = ""
valeur7 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv\Start" )
If valeur7 <> "3" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wuauserv\Start", 3, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Désactive les bulles de notifications pour l'antivirus
'----------------------------------------------------------
valeur8 = ""
valeur8 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\AntiVirusDisableNotify" )
If valeur8 <> "1" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\AntiVirusDisableNotify", 1, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Désactive les bulles de notifications pour le pare-feu
'----------------------------------------------------------
valeur9 = ""
valeur9 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\FirewallDisableNotify" )
If valeur9 <> "1" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\FirewallDisableNotify", 1, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Ignore l'antivirus
'----------------------------------------------------------
valeur10 = ""
valeur10 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\AntiVirusOverride" )
If valeur10 <> "1" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\AntiVirusOverride", 1, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Ignore le Pare-feu
'----------------------------------------------------------
valeur11 = ""
valeur11 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\FirewallOverride" )
If valeur11 <> "1" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center\FirewallOverride", 1, "REG_DWORD" 'clé Dword
End If
'----------------------------------------------------------
'Désactive l'envoi d'invitations d'assistance et l'autorisation de connexion à distance
'----------------------------------------------------------
valeur12 = ""
valeur12 = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\fAllowToGetHelp" )
If valeur12 <> "0" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\fAllowToGetHelp", 0, "REG_DWORD" 'clé Dword
valeur13 = ""
valeur13 = WshShell.RegRead("HKEY_CURRENT_USER\Printers\Settings\fAllowFullControl" )
If valeur13 <> "0" Then
Set WshShell = CreateObject("Wscript.Shell" )
WshShell.RegWrite "HKEY_CURRENT_USER\Printers\Settings\fAllowFullControl", 0, "REG_DWORD" 'clé Dword
End If
End If
'----------------------------------------------------------
'Fin de la mise à jour de la base de registre
'----------------------------------------------------------
Else If OS <> "Microsoft Windows XP" Or SP2 <> "Service Pack 2" Then
Msgbox "OS pas ok ou SP2 pas ok"
End If
End If
'---
Message édité par killapig le 27-06-2005 à 15:06:00
---------------
Retraité du Hardware