Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2004

Tip: Looking for answers? Try searching our database.

Automating Installation of Windows Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vikram - 10 May 2004 04:02 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.