Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 6

Service failing to start during install. Need to set "Log on as service" policy

I am using Installshield (Basic MSI) to install and start a service during the installation process of my product. I am using the service control settings to start the service. During the install my service fails to start and I get this error in the event log.

This service account does not have the necessary user right "Log on as a service."

User Action

Assign "Log on as a service" to the service account on this computer. You can use Local Security Settings (Secpol.msc) to do this. If this computer is a node in a cluster, check that this user right is assigned to the Cluster service account on all nodes in the cluster.

Is there a way in Installshield to automatically add this user to this policy?
Labels (1)
0 Kudos
(2) Replies
Level 6

This may not be the most elegant solution, but it's what I do.

step 1: place NTrights.exe in your support files directory (found in resource kit).

note: this is called by another installscript method of mine that has already figured out where supportDir is, but if you need to get it yourself you can use MsiGetProperty or any other method you prefer.

// Sets a user's "Start as service" right.
function UTIL_SetLogonAsServiceRight(hMSI, userName, supportDir)
string path, cmdLine;
number returnValue, buffer;
UTIL_WriteToLogFile(hMSI, "Entering SetLogonAsServiceRight for user: " + userName);

// NTRIGHTS.EXE is in the Support Files/Language Independent section of the MSI database.
// The SeServiceLogonRight allows the specified User Id to be used as security credentials for a service.
path = supportDir ^ "NTRIGHTS.EXE";
cmdLine = "-u " + userName +" +r SeServiceLogonRight";
UTIL_WriteToLogFile(hMSI, "Executing:" + path + " " + cmdLine);
returnValue = LaunchAppAndWait(path, cmdLine, WAIT | LAAW_OPTION_HIDDEN);
if (returnValue != ISERR_SUCCESS) then
return -1;
return 0;
UTIL_WriteToLogFile(hMSI, "Exiting SetLogonAsServiceRight");
0 Kudos
Level 6

This was the only way I could think of doing it as well. I guess I will just go ahead and follow this.
0 Kudos