2

Yesterday I was playing with the WindowsService project option on Visual Studio and when trying to install my service I was facing errors, after a few tries it finally occurred to me that I would probably need admin rights to install a service. And it did install when I switched to "Run as Administrator". But what it got me thinking, is that, how are other programs, like PunkBuster, AMD Drivers, Adobe Acrobat Update Service, Filezilla Server FTP... and so on, capable of installing a service by simply running an executable and not showing any kind of window to request admin rights? I mean, if I really wanted to, how would I go about doing the same with an application created by me?

4
  • 2
    I don't know how they do it, but you can't be a Windows Service without entries in the Registry, and in general, it takes admin writes to write to the Registry. Commented Mar 1, 2014 at 12:40
  • If it takes admin rights to write to registry how come I can simply create/modify keys by using the Registry class without running my app as admin nor requesting admin on the manifest? Commented Mar 1, 2014 at 15:03
  • Depends on which registry keys Commented Mar 1, 2014 at 17:16
  • 1
    "like PunkBuster, AMD Drivers, Adobe Acrobat Update Service, Filezilla Server FTP" - those applications request elevation prior to installation. Commented Mar 2, 2014 at 12:39

2 Answers 2

7

This is not the answer you want to hear, nonetheless it is the answer: That's not possible. You do need admin rights to install Windows services, and there is no way around this.

The other programs you mentioned most likely got the admin rights already (like requested it when started) or asked the user for these rights at runtime.

Sign up to request clarification or add additional context in comments.

Comments

0

you can make a install package, for example, use installshield, this tool can do something for you: register COM objects, install/uninstall services.

1 Comment

"register COM objects" - only a half-measure for the current user only and is denied access to HKEY_CLASSES_ROOT. Windows Services? No it can not

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.