473,808 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WindowsService/InstallUtil:Pas s 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(tr ue)]
public class MyServiceInstal ler:Installer
{

private ServiceInstalle r serviceInst;
private ServiceProcessI nstaller serviceProcessI nst;

public MyServiceInstal ler():base()
{
this.servicePro cessInst = new ServiceProcessI nstaller();
this.servicePro cessInst.Accoun t = ServiceAccount. User;
this.servicePro cessInst.Userna me = null;
this.servicePro cessInst.Passwo rd = null;
Installers.Add( ... )
}

public override void Install(IDictio nary savedState)
{
if(base.Parent. Parent.Context. Parameters["username"] != null)
{
this.servicePro cessInst.Userna me =
base.Parent.Par ent.Context.Par ameters["username"];
}
if(base.Parent. Parent.Context. Parameters["password"] != null)
{
this.servicePro cessInst.Passwo rd =
base.Parent.Par ent.Context.Par ameters["password"];
}
base.Install(sa vedState);
}

}//class

I am interested to see better code ;-)

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

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

Similar topics

7
3693
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 to it, using installutil.exe OR is it must to have an installer to the service project to be able to
3
1081
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, then I configured the properties of the installers When I run InstallUtil on the executable, it fails with the following message "An exception occurred while trying to find the installers in the c:\...\obj\debug\MyService.exe assembly...
0
377
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 wrong. But I am definitely stuck on this one. I cannot find a solution Make a new C# service project, and add an installer for the service (using menu). Set properties for a test scenario, don't modify code. Run InstallUtil, everything installs fine....
7
34389
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? ---------------------------------------------- when you fear to fail, you fear something that has not yet happened. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
4
2863
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 that project in a different location where I can experiment with customizing it while leaving the original project safe and intact. So I copied everything to its new location OK, but now I need to run: Installutil.exe...
3
11970
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 far as creating a service with 2003 C# that Installutil works with with then I try to upgrade the 2003 project to 2005 and then I start getting the excpetion again. Is there a known issues with this or s there a work around for this?
1
1296
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 INSTALLUTIL but it's als negative. I only get this error: System.IO.FileNotFoundException: Data or Assembly could not be found ???? How can I install my windowservice ? Please help
1
20408
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 (C#); public class MyServiceInstaller : System.Configuration.Install.Installer { private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller;
2
3145
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 right. My question now, how can I know, in my code in Installer class, if the caller is MSI or installutil ??
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10631
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7651
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.