473,405 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

WindowsService/InstallUtil:Pass user/pwd from commandline to installer

Hi All!

After hours of searching the net, I found nothing really substantial
about this. For me, passing username and password from the commandline,
is not very unsecure, but there is no way described, how this can work.
Without preparation, a GUI appears, even user/pwd are specified on the
commandline. Naturally, I do not want to specify username and password
in the source [this would work].

I experimented with the installer classes and discovered their hierarchy
a little bit. I came to really ugly code in my service installer class,
but it works:

[RunInstaller(true)]
public class MyServiceInstaller:Installer
{

private ServiceInstaller serviceInst;
private ServiceProcessInstaller serviceProcessInst;

public MyServiceInstaller():base()
{
this.serviceProcessInst = new ServiceProcessInstaller();
this.serviceProcessInst.Account = ServiceAccount.User;
this.serviceProcessInst.Username = null;
this.serviceProcessInst.Password = null;
Installers.Add( ... )
}

public override void Install(IDictionary savedState)
{
if(base.Parent.Parent.Context.Parameters["username"] != null)
{
this.serviceProcessInst.Username =
base.Parent.Parent.Context.Parameters["username"];
}
if(base.Parent.Parent.Context.Parameters["password"] != null)
{
this.serviceProcessInst.Password =
base.Parent.Parent.Context.Parameters["password"];
}
base.Install(savedState);
}

}//class

I am interested to see better code ;-)

Thanks and
best regards,
mabra
Jul 16 '07 #1
0 1719

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: sidd | last post by:
Hi All, i have some doubts on .net windows services.. please see if some one could help me understand this.. 1)is it possible to install a windows service which does not have a installer added...
3
by: TT (Tom Tempelaere) | last post by:
Hi there I am making a service project in C#, and I'm in the process of writing the installer. I made an installer class by using the "Add Installer" menu-item in the design window of the service,...
0
by: TT (Tom Tempelaere) | last post by:
Hi there The following is a description to reproduce the problem. I do not know if this is a bug in the .NET environment/framework (I suspect it is), or if there is something that I am doing...
7
by: scarred wind | last post by:
when i run my program, an error message prompt me that i should add the installutil.exe. How do i checked for the installutil.exe? How can i add it to my Timer program? ...
4
by: moondaddy | last post by:
I installed the exception management block on my computer and it defaulted to: C:\Program Files\Microsoft Application Blocks for .NET\Exception Management\Code\VB\ Now I want to make a copy of...
3
by: Installutil System.BadImageFormatExcepti | last post by:
I've tried to make a Windows Service using the 2005 C# and when I go to use Installutil it returns with an System.BadImageFormatException error while intializing the installation. I've even gone as...
1
by: Michal Sodomka | last post by:
Hi, is there a clean way how to install windowsservice with some SETUP.EXE project ? I tried this out but after that installation I see my service in servicemanager not ! I also tried it with...
1
by: =?Utf-8?B?Qi5BaGxzdGVkdA==?= | last post by:
Hi all, This is something that I have been toying with for about a week now. What I want to achieve is Install a Service with Customised parameters (using InstallUtil.exe) for User Name. Example...
2
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all people, everybody I create several windows services in VS 2005. The services can be installed by MSI, and too using installutil command. If the service has Installer class, all is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.