Jump to content

Scripting MSI Uninstall


ZThurlow
 Share

Recommended Posts

this works for me. use your credentials and network names of course. I tested it 10 times on Win7/Server 2008R2. should work for Win10. let me know if it does not. it took almost 13 seconds to complete, get rid of the space between /X and the {GUID}. You can use RunAsWait and provide your credentials, just use the proper uninstall string "MsiExec.exe /X{5B51E040-91DA-11E7-A3C5-54EE755D74E2} /qn"

#RequireAdmin

#include <MsgBoxConstants.au3>
#include "log4a.au3"
#include "RegSearch.au3"

;~ Global $sUserName = "root"
;~ Global $sPassword = "Hello1"
;~ Global $sNetwork = "network"

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

RunWait("MsiExec.exe /X{5B51E040-91DA-11E7-A3C5-54EE755D74E2} /qn")
If @error Then MsgBox($MB_OK, "Error", @error)

 

Capture.PNG

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

  • Moderators

Again, all the functionality you need is built into msiexec, no need to go to a third party product. Logging is not enabled unless you tell it to with the /l switch. So /lv <path to log file> will give you verbose logging of the uninstall.

"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

i think taking the space out between the /x and the guid will fix it. it did for me.

that installer puts in this for the actual uninstall string

MsiExec.exe /I{5B51E040-91DA-11E7-A3C5-54EE755D74E2}

Notice there is no space between /I{GUID}

the sample I provided just above uses an /X insead of /I

RunWait("MsiExec.exe /X{5B51E040-91DA-11E7-A3C5-54EE755D74E2} /qn")

and it works like a charm. in fact in my InstallScript routine, there was no space, that's why it works.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Earthshine... it did work! One potential issue though. When I launch the script I get a popup asking if I want to allow running the AutoIT script... I am guessing that is coming from the #requireadmin at the top. If I added this exe to a GPO, will user's get that prompt? If so, that could be a problem...

Link to comment
Share on other sites

20 minutes ago, ZThurlow said:

Earthshine... it did work! One potential issue though. When I launch the script I get a popup asking if I want to allow running the AutoIT script... I am guessing that is coming from the #requireadmin at the top. If I added this exe to a GPO, will user's get that prompt? If so, that could be a problem...

Indeed, that is because of the admin priv being needed by UAC and such. Always a pleasure to help. Happy programming and check back if you have issues.

Try to use RunAsWait and use your credentials, whatever they may be, just use that exact uninstall string and you should be set and won't need to keep the RequireAdmin directive, like so.

#include <MsgBoxConstants.au3>

Global $sUserName = "root"
Global $sPassword = "Hello1"
Global $sDomain = "network1"

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

;~ RunWait("MsiExec.exe /X{5B51E040-91DA-11E7-A3C5-54EE755D74E2} /qn")
RunAsWait($sUserName, $sDomain, $sPassword, 4, "MsiExec.exe /X{5B51E040-91DA-11E7-A3C5-54EE755D74E2} /qn")
If @error Then MsgBox($MB_OK, "Error", @error)

Now put that in GPO and give it a test. Holler back if something is amiss.

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