Jump to content

Scripting MSI Uninstall


ZThurlow
 Share

Recommended Posts

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?!

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

/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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...