Thursday, May 24, 2012

To uninstall using product code - Any app


To uninstall using product code (you can uninstall multiple apps at one go) - use product cod​e.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

SCCM to Tanium

SCCM transition Options: of course intune otherwise  Deployment, Patching - Tanium Image - Tazier Inventory - Tanium Remote Control - Zoom  ...