To uninstall using product
code (you can uninstall multiple apps at one go) - use product code.txt and
make sure that product code in the text file
-------------------------------------
On error resume next
Dim WSHShell, objFSO,
strParentFldr, strProdFile,objTemp,strLine , strRegKey, strSubKey,
strUninstallString, exitcode
Set WSHShell =
CreateObject("WScript.Shell")
Set objFSO
=CreateObject("Scripting.FileSystemObject")
strParentFldr =
objFSO.GetParentFolderName(wscript.ScriptFullName)
strProdFile = strParentFldr
&"\ProductCode.txt"
Set objTemp =
objFSO.OpenTextFile (strProdFile, 1, True)
strSubKey = ""
Do while Not
objTemp.AtEndOfStream
strLine = objTemp.ReadLine
strRegKey =
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"&
strLine & "\"
strSubKey = WSHShell.RegRead (strRegkey& "DisplayName")
if strSubKey <> "" Then
strUninstallString ="msiexec /x" & " " & strLine
& " /qn"
exitcode =WSHShell.Run(strUninstallString, 1, True)
End IF
strSubKey = ""
Loop
Wscript.quit (exitcode)
No comments:
Post a Comment