Jump to content

Issue with MSI Uninstall


Recommended Posts

Hello all -

I've been reading these forums a lot the past few months as I'm trying to learn AutoIT to help with some of the tasks we perform at work.

I'm kind of at my wits end on this and I'm hoping someone here has seen this and worked around it. I am not an AutoIT expert - but I do understand some of the basics and I've been successful with some scripts. I'm really good at researching and though I've tried, I haven't been able to find anything about this.

I'm trying to write a script to uninstall Pulse Secure software so that we can then reinstall the new agent. I found the Uninstall string in the Registry and I can run it no problem from a CMD line. But when I plug the same command into AutoIT, I get the error "This action is only valid for products that are currently installed".

I'm not positive, but I don't think it's a syntax issue. I've tried both of these :

RunAsWait($sUserName, @ComputerName, $sPassword, 0, "msiexec.exe /X{6A483E85-C7F0-495E-84D5-D01C0BC5B9E3} /qb")

AND

RunAsWait($sUserName, @ComputerName, $sPassword, 0, 'msiexec.exe /X "{6A483E85-C7F0-495E-84D5-D01C0BC5B9E3}" /qb')

I get the same error either way. But I can find that Product GUID in the registry with that uninstall string, run that uninstall string at a cmd prompt, and it works fine. Can someone tell me what the issue might be?

Link to comment
Share on other sites

hang on. lemme look up some of my past stuff. if that fails, i need a place to download the msi so i can test it in a vm. this is doable for sure.

you should just be able to to do the following

RunWait("Your uninstall string here");

also make sure you use the following at the top of your script

#RequireAdmin

so it makes it run at admin level else the msi will not uninstall or install in most user cases based on user privs.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Thanks Earthshine - can I put an MSI up on here though? I can PM you a link if not.

I have the #RequireAdmin bit, I didn't post the entire snippet of code - but I narrowed it down to this one command that is tripping it up.

Link to comment
Share on other sites

OK I figured out what the issue is - I think that the software that this MSI is referring to is user profile based somehow. Even though it shows up in Add/Remove and even though its in HKLM uninstall keys. If I install the software with the user id that I am using the RUNAS command with, the script works. If the software was installed by another user, it fails. Somehow, that software is installing something profile-based. Have you ever seen that before? And if so, what options would I have if the user that needs to run this is not a local admin?

 

Link to comment
Share on other sites

admin should still be able to install/uninstall, perhaps you need domain admin privs.

 

with InstallShield you can make user based installs, sure. Since I don't do this or work with them, I have no idea what could be done at this point, and I am busy with real work. perhaps others could chime in.

 

what are you trying to automate? give me a link to the msi in question so i can run it in a vm and test it.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

I think the issue is that your script isn't elevated, RunAs doesn't elevate the script, as EarthShine pointed out you would require #RequireAdmin at the top of your script, but that will prompt for username and password, before running the script.  So you would need to use something like Task Scheduler or PSExec to elevate as a non-admin (see post attached).  There are also tools like PDQ Deploy or Lansweeper where you can create full package deployments across your network.

 

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