Sometimes Windows services in companies are used for important things, and they could stop responding, meaning critical production tasks stops being executed or the Windows print Spooler service may hang, thus they need to be restarted.
Here you can see, how you can give a “normal” user the privileges for doing just that, and nothing else.
Download the subinacl.exe from the WIndows ressource kit fro mthe Web Achive, as it’s not avail anymore:
or download as zip from my blog here: subinacl.zip
Then run as elevated prompt and change to the directory, where the msi has been installaed to:
“C:\Program Files (x86)\Windows Resource Kits\Tools\”
subinacl.exe /service Spooler /grant=domain\jt=PTO
Here the access has been granted to the user domain\jt.
=PTO means this:
Now the user can start “Service manager” and connect to the server where you set this and start/stop pause this one service 🙂
On remote server, you may encounter Access denied, when trying to restart the service, the fix is this:
- Select Start, select Run, type regedit in the Open box, and then click OK.
- Locate and then select the following subkey in the registry:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurePipeServers\SCM
Note If the subkey does not exist, you must create it: On the Edit menu, select New, and then select Key. Type the name of the new subkey and then press Enter.
- On the Edit menu, point to New, and then select REG_MULTI_SZ Value.
- Type RemoteAccessCheckExemptionList for the name of the REG_MULTI_SZ value, and then press Enter.
- Double-click the RemoteAccessCheckExemptionList value, type the name of the service to exempt from the new policy, then click OK.
- Exit Registry Editor, and then restart the computer.
The the remote user can restart the service with this simple batch script:
sc \\server.domain.local stop “Spooler”
sc \\server.domain.local start “Spooler”
REM Add delay to wait for service to start
REM Check if the server actually started
sc \\server.domain.local query “Spooler”
UPDATE: 18/1-2021, found this brilliant tool, for achieving the same:
And it’s free!