3

I'm writing a small app to install some product and uninstall some other in silent mode.
Every product has its MSI file and nothing else and my app manifest states that it should be run with admin privileges.
It's pretty easy to run msiexec with proper arguments to accomplish my task (just a bunch of code) and everything is working fine.
Anyway some package takes a lot of time to finish and on some old pc user is asking if something is still going on in background or it's hang.
So is it possible to "catch" msiexec progress and for example update a progressbar on my app? Sounds crazy, but I'm pretty sure that some professional installer works this way running external msi package.
So, is it possibile? Is there something we can do in C# or is it a very hard task that requires a lot of knowledge I don't have?

Just a note: I know I could use "/qb" param, but some package is not behaving the correct way with it and I don't want to use it.

Marco
  • 56,740
  • 14
  • 129
  • 152
  • Just a note: I don't think, your are right that "/qb" behaves different for some packages than "/qn". In my long experience, I am no aware of any case where this was true. Technically, none of them uses the socalled user sequence, so the install behaviour is the same besides the progress bar and the few dialog box possibilities. What is true, that the UAC coming up lately, behaves different than if you have admin rights from the beginning, but this has nothing to do with "/qb" itself. – Philm Aug 07 '13 at 10:44

2 Answers2

5

You probably will have to consume Windows Installer API directly if you want to monitor progress,

http://www.codeproject.com/Articles/5773/Wrapping-the-Windows-Installer-2-0-API

This CodeProject article shows a sample, while Microsoft has little information about the functions on MSDN,

http://msdn.microsoft.com/en-us/library/windows/desktop/aa370384(v=vs.85).aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/aa368786(v=vs.85).aspx

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • Thanks, I'll read and try! I didn't know there are APIs for Windows Installer... good. +1 for your knowledge :) – Marco May 30 '12 at 07:56
-1

instead of this

So is it possible to "catch" msiexec progress and for example update a progressbar on my app?

you can have a normal progresBar that will keep running until the task has been done something like this

     myProgressBar.Style = ProgressBarStyle.Marquee;

from Marquee also check msdn.microsoft.com

enter image description here

1.Keep a check if msiexec is running

2.start the myProgressBar.Style = ProgressBarStyle.Marquee;

3.Keep running enter image description here

4.If msiexec has finished then hide the progresBar

Community
  • 1
  • 1
PresleyDias
  • 3,657
  • 6
  • 36
  • 62
  • Thanks for your answer, but having a marquee or nothing is the same in this situation: I want my customer to be "notified" about the real progress. – Marco May 30 '12 at 07:57
  • 1
    ok but in the ur app u can have the marquee to display the `Indeterminate progress` this atleast they know somthing is cooking in the background other than no display – PresleyDias May 30 '12 at 08:00