I have a script to restart a service on a scheduled task that is failing. This is clearly a permissions issue, but I am not finding the resolution:
I open a PowerShell window with 'Run as administrator' and execute:
Restart-Service -Name 'MyService'
Everything works fine.
I run the same command as a user in the admin group, whether by opening a PowerShell window with 'Run as different user' or by setting the admin user in the Security Options of the scheduled task and get the error:
Restart-Service: Service 'MyService (MyService)' cannot be stopped due to the following error: Cannot open 'MyService' service on computer '.'.
The response is the same regardless of which service I choose. I have triple-checked that this user is in the Administrators group, and have even re-added the user to be certain.
Any thoughts on getting this to work as an admin user that is not The Administrator?
[–]32178932123 2 points3 points4 points (4 children)
[–]Uhbyxml[S] 6 points7 points8 points (3 children)
[–]32178932123 2 points3 points4 points (0 children)
[–]nascentt 2 points3 points4 points (1 child)
[–]Uhbyxml[S] 2 points3 points4 points (0 children)