none
C# Setup Project for Service: Disable dialog "Set Service Login" from appearing?

    Question

  • Hi

    When creating a Setup project for adding a new Windows Service, is there a way for the setup to assume install is trusted and popup of dialog "Set Service Login" does not need to occur?

    In other words, is there a way to disable "Set Service Login" from appearing during install?


    Thanks
    Jeff in Seattle
    Tuesday, June 01, 2010 6:20 AM

Answers

  • I have found the answer. When creating Process installer:

    private void InitializeComponent()
    {
    	// ...
    
    	// 
    	// ProcessInstaller
    	//
    	this.myProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
    	this.myProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
    	this.myProcessInstaller.Password = null;
    	this.myProcessInstaller.Username = null;
    
    	// ...
    
    }
    
    private System.ServiceProcess.ServiceProcessInstaller myProcessInstaller;

    Thanks
    Jeff in Seattle
    Wednesday, June 02, 2010 5:05 PM

All replies

  • Hi Jeff,

     

    Do you use Visual Studio setup project to deploy the Windows Service? If so, you can change the Account for the serviceProcessInstaller to LocalSystem. This article gives you more detail information about that.

    http://www.codeproject.com/kb/dotnet/simplewindowsservice.aspx

     

    Turn to the Tip paragraph, it reads

    To avoid being asked about the system username and password you must change the Account for the serviceProcessInstaller to LocalSystem. This is done by opening the ProjectInstaller design and then selecting the serviceProcessInstaller, press F4 and then change the Account property to LocalSystem.

     

    Hope it helps. If you have anything unclear, please feel free to tell me.

     

    Sincerely,

    Kira Qian

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    Wednesday, June 02, 2010 7:14 AM
  • I have found the answer. When creating Process installer:

    private void InitializeComponent()
    {
    	// ...
    
    	// 
    	// ProcessInstaller
    	//
    	this.myProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
    	this.myProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
    	this.myProcessInstaller.Password = null;
    	this.myProcessInstaller.Username = null;
    
    	// ...
    
    }
    
    private System.ServiceProcess.ServiceProcessInstaller myProcessInstaller;

    Thanks
    Jeff in Seattle
    Wednesday, June 02, 2010 5:05 PM
  • Yeah, right, apparently that's just it, besides what MSDN informs about the Account property of the System.ServiceProcess.ServiceProcessInstaller component. But Jeffrey,my dear, and whoever is up to lend a hand, I'm trying to do the simple same thing, to install a service, and no matter what kind of account I do set on this property, it keeps asking for a login info.

    Any ideas? 

    Thanx

    Sunday, December 11, 2011 10:27 AM
  • There may be something wrong with your code or the way you're calling it. We don't do psychic debugging ;=) so post your Install method from your setup. Also we're assuming that you are using a custom action in a setup project to do a fresh install.
    Phil Wilson
    Tuesday, December 13, 2011 7:52 PM
  • Thanks a ton :)

     

    Wednesday, January 11, 2012 5:44 AM