Etat du script: Fonctionnel
Présentation:
Le script:
'Suppression d'une application (ici: Trend Antivirus sans serveur Offiscan rattaché)
'Version 0.1 20091124 by Clockover
Set WshShell = wscript.CreateObject("Wscript.Shell")
'Récupération de la version actuellement installée
version = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{ECEA7878-2100-4525-915D-B09174E36971}\VersionMajor")
If (Err.number = 0) Then
'msgbox "Debug: OfficeScan est installé"
if (version < 10) then
'msgbox "Debug: Version inférieure à 10 => désinstallation"
'Activer l'autorisation de le supprimer
WshShell.RegWrite "HKLM\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc\Allow Uninstall\", "1"
'Suppression
Dim oReg, oShell, oFSO
Dim UninstallString, ProductCode, i
Dim strComputer, colItems, objWMIService, objItem
Dim strKeyPath, subkey, arrSubKeys
strComputer = "."
'Product ID du logiciel à désinstaller (ici pour Trend)
ProductCode = "{ECEA7878-2100-4525-915D-B09174E36971}"
UninstallString = "MsiExec.exe /X" & ProductCode & " /qn" & " /norestart"
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
'Recherche de l'existance de ce product ID dans la machine (inutile puisqu'on l'a déjà testé mais pratique pour adapter)
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If subkey = ProductCode Then
i=0
i= WshShell.Run(UninstallString, 1, True)
WScript.Quit(i)
End If
Next
Set WshShell = Nothing
Set oReg = Nothing
end if
else
'msgbox "Debug: OfficeScan non installé"
end if
TODO Liste:
Historique:

Version 0.1 (2009/11/26)Page générée en 0.006 secondes