Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 699

VBS for uninstall a Windows installer

$
0
0
Dear all,

Can someone please help me out with this script? I can't make it work. I am not so familiar with the vb script :(

Thanks for your help!!!!

Code:

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 ************

Name:  sonic.jpg
Views: 28
Size:  43.3 KB
Attached Images
 

Viewing all articles
Browse latest Browse all 699


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>