Bonjour a tous,

Mon nom est James et j'aurai besoin d'aide pour finaliser un script VB, c'est pour supprimer/désinstaller un soft dans Windows installer avec l'aide de la base de registre.

Avec l'aide de google j'ai trouvé se script et j'ai essayé de le finaliser mais ça ne marche pas. Est-ce que quelqu’un pourrez m'aider?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
Option Explicit 'all variables must be defined
 
Dim oReg, oShell, oFSO 
Dim UninstallString, ProductCode
Dim strComputer, colItems, objWMIService, objItem
Dim strKeyPath, subkey, arrSubKeys
strComputer = "." 
 
'********************************
'Enter Product Code Of The Application Here That You Want To Uninstall within the Bracket 
ProductCode = "{88C972E7-D7FC-40F3-9FE5-180957F37B45}"
 
'********************************
 
' Get scripting objects needed throughout script.
Set oShell = CreateObject("WScript.Shell")
 
'**************************
UninstallString = "MsiExec.exe /X{88C972E7-D7FC-40F3-9FE5-180957F37B45} /qn" & " /norestart"
 
Const HKEY_LOCAL_MACHINE = &H80000002
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ 
strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
 
For Each subkey In arrSubKeys 
 
 IF subkey = ProductCode Then 
 oShell.Run UninstallString, 1, True
 End If
 
Next
 
Set oShell = Nothing
Set oReg = Nothing
'************* End Code ************
Nom : sonic.jpg
Affichages : 988
Taille : 112,0 Ko

Si qq'un pourrais m'aider je serais éternellement reconnaissant. :-)