Search code examples
visual-studio-2015installshieldinstallshield-le

Installer for Windows service that must run as "Network Service"


Using Visual Studio 2015, how do I configure an installation package using InstallShield for a Windows service to run under the "Network Service" account? I had this working in Visual Studio 2013, with an InstallShield project, but I can't seem to get it going in this new version.

If I leave the "User Name" and "Password" fields empty (on the Installshield project's "3 - Configure the Target System / Services" screen), the installed service is configured to use "Local System".

If I enter "Network Service", "NetworkService", "NT_AUTHORITY\Network Service", ".\Network Service" or ".\NetworkService" as username and leave password blank, when I try to install the service, I get the following error:

Error 1923. Service [name] could not be 
installed. Verify that you have sufficient 
privileges to install system services."

As of my typing this, I haven't been able to find any information related to this on their Express Edition documentation:

http://helpnet.flexerasoftware.com/isxhelp21/isxhelp21.htm#StartTopic=helplibrary/FAQFilesNTService.htm

http://helpnet.flexerasoftware.com/isxhelp21/isxhelp21.htm#StartTopic=helplibrary/ServiceSettings.htm

This blog post discusses the changes in this new version for creating a service installer:

http://blogs.flexerasoftware.com/installtalk/2014/10/updated-support-creating-an-installation-that-installs-windows-services-.html

My previous installer must have used the "old method of using installer classes", because my project does have an installer class that specifies the NetworksService as the user to run as. (The link to the article discussing this generally-not-recommended method is broken.)

As far as I can tell, the new Express Edition appears to ignore the installer class I have, and I haven't yet found how to go back to the old method that "is fragile and generally not recommended."


Solution

  • I haven't found any information on how to make this happen with InstallShield LE (Express Edition) in Visual Studio 2015.

    Since my service is only being deployed to a single server, my needs aren't overly complicated. I have added a project installer class to my Windows Service project, as described here https://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx in the "Adding Installers to the Service" section. This allows you to choose "Network Service" user, as a property in the ServiceProcessInstaller.

    As described in the "Installing the Service" section, I'm scripting the install with:

    %WINDIR%\Microsoft.NET\Framework64\[framework_version]\installutil.exe MyService.exe
    

    Uninstall can be done with:

    %WINDIR%\Microsoft.NET\Framework64\[framework_version]\installutil.exe /u MyService.exe
    

    These commands have to be run as administrator or you'll get an error.