How to grant LogOnAsService during install?

M

mdb

I'm using an Installer class to install my windows service. I want to
configure it to log on as a user. When I did this, it worked at first, but
after about a day it wouldn't work anymore. When I try to start the
service it was complaining that it couldn't start due to a logon failure.

I then changed the password in the service configuration (actually I just
typed the same password again since I'm sure it was correct) and it then
said that the account had been granted LogOnAsService rights.

How can I have the InstallUtil / MSIInstaller grant this right during
installation?

-mdb
 
W

Willy Denoyette [MVP]

mdb said:
I'm using an Installer class to install my windows service. I want to
configure it to log on as a user. When I did this, it worked at first,
but
after about a day it wouldn't work anymore. When I try to start the
service it was complaining that it couldn't start due to a logon failure.

I then changed the password in the service configuration (actually I just
typed the same password again since I'm sure it was correct) and it then
said that the account had been granted LogOnAsService rights.

How can I have the InstallUtil / MSIInstaller grant this right during
installation?

-mdb

This is done automatically.
In your service you specifiy the account under wich it will run, when you
specify an account that hasn't this privilege, the installer will grant this
privilege to this account when installing.

Willy.
 

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

Top