/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Silent Uninstall of BlueJeans (installed to Local AppData)

08/07/2020 433 views

Hey all!

I'm having a hell of a time figuring out how to script out an uninstall of BlueJeans from a handful of user computers. They went with the per-user install, which means it's installed to Local App Data and all the switches I've tried (/silent, /qn, /q, quiet) all go nowhere. 

Has anyone managed to pull this off?

0 Comments   [ + ] Show comments

Comments


All Answers

0

Be sure that you are running the uninstaller in the user's context else it will not be able to find the installed package.  That is, you can't use an administrative or service account in the scripting page, you have to set it to use the current user in their context and that also means they need to be logged in to do this.

Answered 08/07/2020 by: RyanTech
Senior Yellow Belt

  • Unfortunately, I tried running as current logged in user. Tried to running the uninstall string in cmd on a target PC with the silent switches but it still brings up the GUI, which I think is why it hangs when I try to deploy remotely.
    • I presume you found this article already?
      https://social.technet.microsoft.com/Forums/en-US/6ca8517e-6159-4dd7-adc8-333a6877895d/best-practice-for-uninstalling-software-with-powershell?forum=winserverpowershell

      Unfortunately if it won't even work locally and the above suggestion doesn't work, I would encourage you to reach out to Blue Jeans directly to see if they can help? If they do, I simply ask that you share the solution on this thread so others may benefit.
  • Are you dealing with local or roaming profiles? One quite simple solution is to use the RunAsCurrentUser executable for which my information is below. Written by IBM, it does appear to work pretty well and has proved invaluable for some of the trickier installs/uninstalls.

    RunAsCurrentUser.exe - https://www-304.ibm.com/support/docview.wss?uid=swg21506033

    A utility, RunAsCurrentUser, can run commands on Windows systems using the credentials and local context of the currently logged on user.

    RunAsCurrentUser.exe is currently available at the following location:
    http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

    The basic usage for the command is as follows
    RunAsCurrentUser.exe [--w] [--q] <program executable> <flags>

    Waiting: RunAsCurrentUser is not a console application; to wait for it to complete before continuing with other actions you will need to use the -w flag in addition to wait or waithidden.

    Examples:
    Wait for a command to finish:
    wait RunAsCurrentUser.exe --w msiexec.exe /i MyProgram.msi /qn

    Wait for a command to finish and try to suppress output:
    waithidden RunAsCurrentUser.exe --w msiexec.exe /i MyProgram.msi /qn

    Relevance: Any Fixlet message or action that uses "RunAsCurrentUser.exe" should have the relevance "exists current user" attached. "RunAsCurrentUser.exe" will not work unless a user is logged into the local computer. You can accomplish this by selecting the option "Run when at least one of the selected users is logged on, and only display the user interface to those users" on the Users tab in the Take Action dialog box when deploying the action.
    Privileges: Note that you accept the local user privileges when you are running as the current user and if the user doesn't have access to install or run certain applications, then your Fixlet message or action will not work. Furthermore, programs that require privilege elevation on Vista, Windows 7, or Server 2008 may require special handling even if the current user has rights to run them. You can use cmd.exe to enable privilege escalation. Example:
    Wait for a command to finish and try to suppress output with privilege elevation protection:
    waithidden RunAsCurrentUser.exe --w cmd.exe /c msiexec.exe /i MyProgram.msi /qn
    Run Quietly: While the waithidden command will cause the TEM Agent parent process to attempt to suppress output, this is not always effective. Use the --q switch to cause RunAsCurrentUser to attempt to suppress visible output as well. Example:
    Wait for a command to finish and try to suppress output with privilege elevation protection:
    waithidden RunAsCurrentUser.exe --w --q cmd.exe /c msiexec.exe /i MyProgram.msi /qn
0

I was once in a similar situation - having to uninstall software from "user's profile". If you are familiar with C# - you could loop through all the user's profiles and initiate the uninstall commands where the software is found.  Below is the C# method, you will have to change the uninstall switches and folder paths accordingly:

 static void UninstallSoftwareName()

        {

            string baseUserFolder, templateAppdata;

            GetAppDataMyFolderPath(out baseUserFolder, out templateAppdata);

            var users = Directory.GetDirectories(baseUserFolder);

            foreach (var userPath in users)

            {

                try

                {

                    string myFolderPath = userPath + templateAppdata + "\\SoftwareName\\uninstall";

                    string myFileName = myFolderPath + "\\SoftwareName.exe";


                    if (Directory.Exists(myFolderPath))

                    {

                        Process Qproc = new Process();

                        Qproc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                        Qproc.StartInfo.CreateNoWindow = true;

                        Qproc.StartInfo.WorkingDirectory = myFolderPath;

                        Qproc.StartInfo.FileName = myFileName;

                        Qproc.StartInfo.UseShellExecute = false;

                        Qproc.StartInfo.RedirectStandardError = true;

                        Qproc.StartInfo.RedirectStandardInput = true;

                        Qproc.StartInfo.RedirectStandardOutput = true;

                        Qproc.StartInfo.Arguments = "/uninstall";

                        Qproc.Start();

                        Qproc.WaitForExit();

                        Qproc.Close();

                    }

                }

                catch (Exception ex)

                {

                    Console.WriteLine(ex.Message);

                }

            }

        }

  let me know.....

Answered 08/11/2020 by: ThebeMatshana
Senior White Belt

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ