Well... title says it all, actually. We've got a Scheduled Task set up on a windows server 2003 box running as the Network Service, and the batch file it runs will invoke "sc" to stop and then start a service on another windows box, however sc reports:
[SC] OpenService FAILED 5:
Access is denied.
Running the same batch file via the windows explorer has no issues, and my user account is part of the Administrators group so I believe this is why there are no issues when I try it manually. Is this a permissions thing I enable for Network Service on the first server? Or do I enable permissions for Network Service somehow on the target server?
This question (why sc query fails from one machine but works from another) touches on something similar, but I'm looking for enabling the Network Service to access the service via the scheduled task.
Try adding the AD account for the computer which is trying to run the command to the Administrators group on the computer with the service being modified.
If the computer running the scheduled task is SERVER1 and the other machine is SERVER2 then in SERVER2's local administrators group put YOURDOMAIN\SERVER1$. The $ is important.