'Date Created 10/26/2016
'Owner - TechSurfer
On Error Resume Next
set Sh = createobject("wscript.shell")
'Change the SOftware Name in below to your application name. Please be careful as this will uninstall everything with the name
'If you have a setup uninstall string, change the run command line below to suit your needs
myret = FINDUNINSTALL64("Software Name")
myret = FINDUNINSTALL("Software Name")
Function FINDUNINSTALL64(strsoft)
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "software\wow6432node\microsoft\windows\currentversion\uninstall" 'OR strKeyPath = "software\microsoft\windows\currentversion\uninstall"' Root level
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
On Error Resume Next
sDisplayName = Sh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\Displayname")
if instr(sDisplayName, strsoft) > 0 then
sDisplayName = Sh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\uninstallstring")
myret = sh.run("cmd.exe /c msiexec /X " & subkey & " /qn REBOOT=ReallySuppress",1,True)
end if
Next
End Function
Function FINDUNINSTALL(strsoft1)
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "software\microsoft\windows\currentversion\uninstall" ' Root level
oReg1.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
On Error Resume Next
sDisplayName = Sh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\Displayname")
If instr(sDisplayName, strsoft) > 0 then
sDisplayName = Sh.Regread("HKLM\" & strKeyPath & "\" & subkey & "\uninstallstring")
myret = sh.run("cmd.exe /c msiexec /X " & subkey & " /qn REBOOT=ReallySuppress",1,True)
End if
Next
End Function