views:

12

answers:

1

Hi, I need to install a windows service running under a given user. It is working with an existing user (ServiceProcessInstaller = User) but when the user does not exist then it should be created before the service install happens. The user must be a mamber of administrators.

How should I do it?

(VS2008, C#)

Thank You.

-- Hudgi

A: 

Adding a Local User
Adding to Active Directory

RandomNoob
Huhh it was fast. :) Thanks, I understand the way I add user from C# code but how to integrate it into the setup project? I need it before the actual nt-service registration is run. The installer pops up a window to ask the user name but it must be an existing one. I need a way to silently create the user if it does not exist.
Hudgi
Could you use the AfterInstallEvent? http://msdn.microsoft.com/en-us/library/system.configuration.install.installer.afterinstall.aspx
RandomNoob
This occurs after the Install methods of all the installers in the Installers property have run.
Hudgi
Before Install? :) http://msdn.microsoft.com/en-us/library/system.configuration.install.installer.beforeinstall.aspx
RandomNoob
It should be an event s.g. like DuringInstall or so :) So you say that there is no way to do s.g. between entering the user credential and starting the actual service install? I do not mean starting the installer! Unfortunately the Before install runs before the installer shows the user account window.
Hudgi