cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Terry2009
Level 3

uninstall failed using Msiexec.exe in Vista

Hello All,
I have a Basic MSI using the Installshield 2008 Premier Edition, there are two problems, please help me, thank you very much.
(1) Major upgrade in Vista
I have a major upgrade in the Basic MSI, it runs well in Windows XP and Windows 2000. but if I upgrade the application via double click the "setup.exe" in vista, the old shortcuts in "Start Menu" can not be deleted sucessfully. While I run it via choosing the "Run as Administrator", it works fine.
We provide the customs with the CD, the behavior of CD autorun is the same as the double click.
If I choose "Administrator" or "Highest available" in "Required Execution Level" of "Release", the major upgrade failed.

(2) Uninstall in Vista
Most software installation CD can automatically run “Setup.exe” under windows.And then the setup can be finished.
But then in our test, we can not uninstall the application successfully via our uninstall.exe, the Uninstall.exe is created by our own project (Because we need to uninstall four MSIs) .

The expected behavior is: directly double click setup.exe or Autorun CD to install the application, and then user can uninstall the application via clicking the uninstall button in “Start Menu”, or directly double clicking the uninstall.exe.

Below is the detail:
If we directly double click setup.exe or Autorun CD to install the App, then we uninstall the application via double click Uninstall.exe or select “Run as administrator” Uninstall.exe to uninstall the application, we can get the below information from the uninstall log:

“MSI (s) (D4:C4) [21:52:48:604]: Product {Product Code} is not managed.
MSI (s) (D4:C4) [21:52:48:604]: Running product '{Product Code}' with user privileges: It's not assigned.

Uninstall will fail.
Then in this case, we can go to control panel – Add/Remove Program to uninstall the application successfully.

If we right click setup.exe, select “Run as administrator” to install, then we uninstall via double click Uninstall.exe or select “Run as administrator” Uninstall.exe to uninstall, we can get the below information from the uninstall log:

“MSI (s) (D0:D4) [22:12:28:728]: Product {Product Code} is admin assigned: LocalSystem owns the publish key.
MSI (s) (D0:D4) [22:12:28:728]: Product {Product Code} is managed.
MSI (s) (D0:D4) [22:12:28:728]: Running product '{Product Code}' with elevated privileges: Product is assigned.”

Uninstall will success.

Same codes, but different results.
The key codes are:

1. Class Process which starts the command.

2. The command for each MSI file is: “msiexec /x {Product Code}”.
args = " /x " + ProductCode + " /passive ";
proc.StartInfo.FileName = "msiexec";
proc.StartInfo.Arguments = args;
proc.Start();
proc.WaitForExit();

1. Double click setup.exe or Autorun CD to install the App, and then open a cmd window from “Start menu”.Then input the command line via keyboard, and then enter.
The PC application will be uninstalled successfully.

2. Double click setup.exe or Autorun CD to install the App,
And then set the process object parameters:

proc.StartInfo.UseShellExecute = true;

proc.StartInfo.FileName = "msiexec";

proc.StartInfo.Arguments = args;

proc.StartInfo.Verb = "RunAs";

proc.StartInfo.UserName = "XXSSD"; //this is the machine adminstrator user account.

proc.StartInfo.Password = Sstring; // and the string is the account password.

The two red lines is the key modification in this case.

Then compile the uninstall project and run it.

It also will be able to uninstall the application successfully.
But we can not set the UserName and Password in advance.

3. Use another method:

int a = ShellExecute(GetForegroundWindow(), new StringBuilder("open"), new StringBuilder("msiexec"), new StringBuilder("/x {Product Code} /lv* E:\\setup_correct12.log"), new StringBuilder(@"C:\ "), 1);

int a = ShellExecute(this.Handle, new StringBuilder("open"), new StringBuilder("cmd"), new StringBuilder("msiexec /x {Product Code} /lv* E:\\setup_correct12.log"), new StringBuilder(@"C:\ "), 1);

These two lines are using “ShellExecute” to run the command. But also failed.

4. the last case is:

proc.StartInfo.FileName = "cmd.exe";

proc.StartInfo.UseShellExecute = false;

proc.StartInfo.RedirectStandardInput = true;

proc.StartInfo.RedirectStandardOutput = true;

proc.StartInfo.RedirectStandardError = true;

proc.StartInfo.CreateNoWindow = true;

proc.StartInfo.Verb = "RunAs";

string strOutput = null;

try

{

proc.Start();

proc.StandardInput.WriteLine("msiexec /x {Product Code}");

proc.StandardInput.WriteLine("exit");

proc.WaitForExit();

It also failed.

How can I uninstall the application sucessfully via installing by double click in vista? Thank you very much!
Labels (1)
0 Kudos
(4) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Is the executable you try to double-click one you create or control? If so, try embedding a manifest that specifies , like the one we have external in \Support\setupexe.admin.manifest.
0 Kudos
Terry2009
Level 3

Thank you for your advice, but the method does not work, it still uninstall the application unsucessfully:(.
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Can you try to distill your error case then? Did the attempt with the modified manifest immediately get you a UAC prompt? (If not, the manifest was probably not correct.)

I got a little lost in your original description. It sounded like the problem was when you launch without administrative privileges, things don't work; correspondingly if you launched with administrative privileges, they worked. But if that's not the case, changing the manifest will only solve the wrong problem.
0 Kudos
Terry2009
Level 3

Now we have solved the problem, becasue we named the uninstall project to "uninstall". But if there are "install", "update", "patch" in your exe files or msi files, there is a scutellate symbol in Vista and need the related privilege.
So we renamed the name and modified related settings.
Thank you very much!
0 Kudos