I am in a siuation where I need to stop and start a windows service automatically and have been unable to come up with the exact script to do it. Here's the scenario:
I have a service we'll call Agent.exe that needs to run during off hours to peform a scan of the workstation in question. I have too many machines to do this as a scheduled task and would like to implement it via a login script for the user or a machine script for the workstation.
The script needs to stop the Agent service at 8 pm and start the service at 4 am with no user intervention.
I have tried the following in a batch file that is supposed to run at login:
at 8:00pm net stop "Agent"
at 4:00am net start "Agent"
If I run this as a .bat file locally on my workstation I have no problems. It executes as desired. However, the minute I plug it into a login it fails with no error warnings or messages.
Any ideas and thoughts are greatly appreciated.