Jump to content
ZThurlow

Scripting MSI Uninstall

Recommended Posts

ZThurlow

Hello, we have about 60+ machines that we need to uninstall some software on (WebEx Productivity Tools). I need to run the the command: msiexec.exe /q /x "ptools.msi". The problem for me is, this command requires that I run it from the directory that has the MSI installer to work which is on a network folder. I also need to run this command with a network administrator account as all the PC's are on an active directory domain. I am limited in my skills with autoit and have tried every variation of my script that I could find and simply cannot get it to work. Please help?!

Share this post


Link to post
Share on other sites
Earthshine

Add a complete path before the MSI file.  It should be the path where that MSI lives on the network

post your Code too

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
ZThurlow

Thanks for the response! Here is the latest variation of code (I have tried several different variations and this was the closest I got). I also would like to include a check for the program before I continued with the uninstall, but I am also still working on the If statements:

 

Global $sUserName = "zthurlow"
Global $sPassword = "password"
Global $sNetwork = "network"

;checking for WebEx Productivity Tools
;If Not fileExists("C:\Program Files (x86)\WebEx\Productivity Tools\CiscoWebExStart.exe") Then Exit If
;EndIf

RunAs($sUserName, $sNetwork, $sPassword, 4, "msiexec /q /x \\lenovo-t440\acromag$\WebExRemoval\ptools.msi")

Edited by ZThurlow

Share this post


Link to post
Share on other sites
Earthshine

use the code tags please.

ok, there is a registry key with the uninstall information. are you not using that string? because I don't think you need the actual msi, at least none that I ever authored worked like that.

To Check if the Program is installed,  look in the following pair of registry keys

64bit windows applications go here:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

32bit windows applications here:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall

So if ptools.msi is x86, then look under the 32bit key on a 64 bit windows.

First, look manually for it. Just look until you find ptools.msi registry key with all it's associated data

look for ptools custom uninstall string and try that, all local

 

There is a Registry UDF around here you can use to easily search registry.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
Earthshine

a custom uninstall string can look something like this for example

MsiExec.exe /X{5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4}

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
ZThurlow

How do I copy the code tags? I did find the uninstall string in reg. I modified script and here is what I have:

 

Global $sUserName = "zthurlow"
Global $sPassword = "password"
Global $sNetwork = "network"

RunAs($sUserName, $sNetwork, $sPassword, 4, "MsiExec.exe /i{5B51E040-91DA-11E7-A3C5-54EE755D74E2}")

 

Only problem I found is it launches the GUI for uninstall. I need to add /q and /x for a quiet uninstall, but anytime I do I get the MSI pop-up box stating I didn't enter the parameters correctly. Thanks for your help!

 

Edited by ZThurlow

Share this post


Link to post
Share on other sites
Earthshine

here is a little something to help you search, the code uses 'ptools.msi' as the search string

log4a.au3

RegSearch.au3

WhatIsInstalled.au3

run this on one of your client machines to see where it lives. use RegRead to get it's UninstallString value and Run That. I hope the problem is solved after that.

Edited by Earthshine
fixed

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
ZThurlow

This code (below) launches the uninstaller, but I just need it to be a quiet uninstall:

Global $sUserName = "zthurlow"
Global $sPassword = "password"
Global $sNetwork = "network"

RunAs($sUserName, $sNetwork, $sPassword, 4, "MsiExec.exe /x {5B51E040-91DA-11E7-A3C5-54EE755D74E2}")

Edited by ZThurlow

Share this post


Link to post
Share on other sites
Earthshine

hang on, lemme dig into one of my installers.. lol

try to use the <> Code tags for code mate. try this

 

Global $sUserName = "zthurlow"
Global $sPassword = "Brighton1"
Global $sNetwork = "taznetworks"
RunAs($sUserName, $sNetwork, $sPassword, 4, "MsiExec.exe /qb /x {5B51E040-91DA-11E7-A3C5-54EE755D74E2}")

 

Proper syntax is

 msiexec.exe
        /qb
        /x
        product_code
      

You can buy me a cup of coffee and we will call it even.... lol, joking. hope this helps you out. I gave you the search code too up there btw.

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
JLogan3o13

If you do an msiexec /? in the run line it will show you proper syntax:

msiexec <install option> <product.msi> <display option>

So msiexec /x <product> /qn for silent

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Earthshine
//---------------------------------------------------------------------------
//  function UninstStackCfg()
//---------------------------------------------------------------------------
function UninstStackCfg()
STRING szCmdLine;
NUMBER nResult;
begin
    nResult = DecrementSharedComponentCount(HKEY_LOCAL_MACHINE, REG_SHARED_APPLICATION, SD_STK_CFG);         
    if (nResult > 0) then
        return(-1);
    else
        szCmdLine = DetectSetupExists(REG_STACK_CFG);
        //MessageBox(szCmdLine, INFORMATION);
        if (StrLength(szCmdLine)>0) then
            SdShowMsg("Uninstalling Stack Configuration Utility", TRUE);
            szCmdLine = "Msiexec /X{" + REG_STACK_CFG + "} /qb";
            nResult = LaunchAppAndWait("", szCmdLine, LAAW_OPTION_WAIT);
            SdShowMsg("Uninstalling Stack Configuration Utility", FALSE);
        endif;
    endif;
end;

yes! that's it. it's the szCmdLine I call to uninstall so JLogan3o13, is correct I was wrong.

The above code is some InstallScript to uninstall one of our apps if it's not being used by any other of our application suites

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
ZThurlow

Here is what I tried, however, it's not uninstalling...nothing happens:

Global $sUserName = "zthurlow"
Global $sPassword = "password"
Global $sNetwork = "network"
RunAs($sUserName, $sNetwork, $sPassword, 4, "MsiExec.exe /x {5B51E040-91DA-11E7-A3C5-54EE755D74E2} /qn")

 

When I try using "msiexec.exe /x /qn <product>" it launches the uninstall process, but needs me to click yes to a few prompts, which I can't do. This needs to be run through a GPO with no user prompts in the background. When I run "MsiExec.exe /x {5B51E040-91DA-11E7-A3C5-54EE755D74E2}" from an elevated command prompt, it does run perfectly with no prompts. I think we are close!

Edited by ZThurlow

Share this post


Link to post
Share on other sites
JLogan3o13

Stick the /qn at the end, after the product id


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Earthshine

It’s /qb at the end. Not /qn. I use /qb in my stuff apparently 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
JLogan3o13

/qn is silent, /qb shows a progress bar (basic UI). Typically you would want a completely silent uninstall so as not to prompt helpdesk calls from users seeing even a progress bar.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
ZThurlow

Ran this (below), does not uninstall. Confirmed my login credentials are exactly right for domain admin account:

Global $sUserName = "zthurlow"
Global $sPassword = "password"
Global $sNetwork = "network"
RunAs($sUserName, $sNetwork, $sPassword, 4, "MsiExec.exe /X {5B51E040-91DA-11E7-A3C5-54EE755D74E2} /qn")

Edited by ZThurlow

Share this post


Link to post
Share on other sites
Earthshine

So what did it do you can you provide screenshots. I would try /qb 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
ZThurlow

Here's a screenshot. Appears to run normally, but application is never uninstalled, nothing pops up.

Capture.JPG

Share this post


Link to post
Share on other sites
Earthshine

OK sounds like you have some troubleshooting to do. Try this. First, uninstall it from the control panel and walk through it and see if there something that stopping it from uninstalling

It would be really cool if you know knew how to find it’s log file

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×