Sometimes, Windows Server users experiences error when trying to add or remove a role and will require a restart of the Server.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our customers to solve Windows related issues.
In this context, we shall look into what causes this error and how to get rid of it.
When this error occurs, you will see an error message such as shown below;
The request to add or remove features on the specified server failed. The operation cannot be completed, because the server that you specified requires a restart.
This error is sometimes experienced when trying to install any role or feature on Windows Server 2016. This prompt you to restart the Server.
This error is a persistent one and even after restarting the Server, it will still remain.
Due to this, you will not be able to install or remove any roles or features on Windows Server.
When you look at the Windows logs located at the (Event Viewer -> Windows Logs -> System), you will see an EventID 7041 and Service Control Manager as the source. The following message will be shown in the event description;
This service account does not have the required user right "Log on as a service".
To fix this issue, start by granting the logon as a service permissions to "NT SERVICE\ALL SERVICES".
The follow the steps below;
1. Begin will Opening the "Local Group Policy Editor" : "gpedit.msc" .
2. Now, navigate to "Computer Configuration" followed by Local Policies in the Windows "Security Settings" followed by the "User Rights Assignment".
3. Then, locate the Log on as a service policy.
4. In some cases, you will see that "NT SERVICE\ALL SERVICES" is not available in the policy. To add it, do it from the (Group -> NT SERVICE\ALL SERVICES).
Sometimes, you might get an error such as "name not found". It is recommended to grant the permissions "Log on as a service" to "NT SERVICE\ALL SERVICES". To achieve this, you can use the "ntrights.exe" tool from the old Windows Server 2003 Resource Kit.
Next, download and install the Server 2003 Resource Kit (rktools.exe). To grant the permission "SeServiceLogonRight" by running the commands via the elevated command prompt as shown below;
cd "C:\Program Files (x86)\Windows Resource Kits\Tools"
ntrights.exe +r SeServiceLogonRight -u "NT SERVICE\ALL SERVICES"
You will get an output message that granting SeServiceLogonRight to NT SERVICE\ALL SERVICES was successful.
Now check the "Log on as a service" permissions in the Group Policy Editor console for the "NT SERVICE\ALL SERVICES".
Finally, restart the Windows Server and try to install or remove the role again. Now the error will be gone.
In this article, you will get the complete tip to fix error "unable to add or remove role: windows server requires restart" by granting SeServiceLogonRight to NT SERVICE\ALL SERVICES.