Monday, January 02, 2012

Installing a User Account Service Unattended (Part 1)

serviceaccount.png

    In many productions environments, Windows Services required to run under a privileged domain account. NET services consume the Installer Class foundation to control its installation flow. In most cases, your .NET service ends up packaged in MSI installer which automates the actions InstallUtil does in command line.

But what if you want to install a user account service automatically without bothering the user (other than the service account user\password entries) with post installation actions? Commonly MSI authors will use the ServiceInstall Table which allows runtime entry of username (‘StartName’ column) and password among other properties. However, in case the target service is always expected to run under a domain account, since Installutil.exe (Installer Tool) 4.0 there is another solution.
Service Setup

    First, the service must be set with user account. Fortunately this is the default behavior of ServiceProcessInstaller.

    this.serviceProcessInstaller = new System.ServiceProcess.ServiceProcessInstaller();
    this.serviceProcessInstaller.Account = new System.ServiceProcess.ServiceAccount.User;
    this.serviceProcessInstaller.Password = null;
    this.serviceProcessInstaller.Username = null;


Read more: KMoraz's Sandbox
QR: installing-a-user-account-service-part-1.aspx

Posted via email from Jasper-Net