Hi,
I am installing a WindowsService using InstallUtil.
This prompts for the UserName and Password. Since I have 4 Services, it
prompts 4 times.
I dont see InstallUtil taking any command line parameters for username and
password.
Is there a way to automate the Installation of Windows Service with a Batch
file/Installer specifying the
username and password ?
Thanks,
Vikram
Samrat - 10 May 2004 08:21 GMT
Hi
pls try this
-
once you have written your service U need to add an installer class;
System.Configuration.Install.Installer.
In the constructor, you need to add a System.ServiceProcess.ServiceProcessInstaller to your Installers collection. This will install the process where your service resides. Set its Username and Password properties to match the username and password of the account you'd like the process to run
try the code below
using System
using System.Configuration.Install
using System.ServiceProcess
using System.ComponentModel
public class MyInstaller : Installe
public MyInstaller(
ServiceProcessInstaller servprocinstl = new ServiceProcessInstaller()
servprocinstl.Username = "yourDOMAIN\\yourusername"
servprocinstl.Password = "yourpassword"
ServiceInstaller servinstl = new ServiceInstaller()
servinstl.ServiceName = "name of the service"
this.Installers.Add(servprocinstl)
this.Installers.Add(servinstl)
hope this works :
Regards
Samrat
New Delhi