How do I allow a (local) user to start/stop services with a scheduled task?

Posted by Mulmoth on Server Fault See other posts from Server Fault or by Mulmoth
Published on 2011-02-14T14:26:32Z Indexed on 2011/02/14 15:27 UTC
Read the original article Hit count: 183

Hi, on a Windows 2008 R2 server I have two small .cmd-scripts to start/stop a certain service. They look like this

net start MyService

and

net stop MyService

I want to execute these script via scheduled task, and I thought it would be best to create a local user for this job. The user is not member of the Administrators group.
But the scripts fail with exit code 2. When I logon with this local user and try to execute these script in command line, I see a message like (maybe not exactly translated from german to english):

Error code 5: Access denied

It doesn't matter whether I start the command line as Administrator or not.
How can this local user gain rights to do the job?

© Server Fault or respective owner

Related posts about windows-server-2008-r2

Related posts about scheduled-task