Uninstall a service from code without using InstallUtil.exe

  • Thread starter Thread starter Marcel Brekelmans
  • Start date Start date
M

Marcel Brekelmans

Hi,

I was wondering if it's possible to install/uninstall a service from code
without using the InstalUtil.exe tool with the /i and /u flags. As far as I
can Google everyone is doing it that way and MicroSoft also mentions this.
There's something like the ServiceBase class from which you ought to derive
your own class. This has a Uninstall() and a Install() method, but I'm not
getting access to these methods. MicroSoft says that this class is not
intended to be used directly, it's there for the InstalUtil.exe utility.

Stopping and starting a service is easy. I use the ServiceController class
for this.

Any suggestions?

Thanks!
 
Hi,

Why don't you want to use it?

If you dont want it to be seen , just run it as a non-windowed program.
 
Yes, thats' the way I've implemented it right now, with all the flags to
have it run without user-interaction (/qb+). I was just wondering if I could
have the job done without instantiating a Process. More or less triggered by
the fact that MicroSoft discouraged it :)
 
There is no problem with spawning a process to do what can not be done
otherwise.
Can you post a reference where Microsoft is discouraging using Process.Start
to start a process?

And finally, is there any particular reason you are refering to Microsoft as
MicroSoft?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top