Schedule task does not work in windows server 2008

2019-05-06 04:29发布

问题:

I am trying to run a .cmd through the task scheduler in windows server 2008 R2.I have logged in to the server from a user who is in the Administrators group in the server machine.When run the scheduled task,the "Last Run Time" column has the value (0x1) while "Status" is ready.and nothing happened. When run the .cmd just double clicking it works fine.Is this an issue with the users in the server or anything ? does anybody know a solution for this issue?

Thanks

回答1:

I'd suggest setting the "Start In..." folder to the directory of where the application is located. Make sure that it has the appropriate permissions for that directory.

That fixed the problem for me!



回答2:

I fixed my issue by Running my .cmd file as the SYSTEM user account. Follow these directions:

1) Try to change "Change User or Group…" in the following way: Click "Change User or Group…" Then click “Advanced…” Then “Find Now” Finally look for "SYSTEM" (ended on “s”) select it and click OK



回答3:

I agree it! Window 2008 schedule usually does not work and you have to try different options or "tricks" until you find a config than works….

Here are some “tricks” I used:

1) Try to change "Change User or Group…" in the following way: Click "Change User or Group…" Then click “Advanced…” Then “Find Now” Finally look for "Administrators" (ended on “s”) select it and click OK .

After the change you will see the options “Run only whe user is loged on” is disable

This allows to run without user logged.

2) If you are running a script (.bat .cmd) sometimes it helps to define the Start in (optional).

3) Setting “Run with highest privileges” also helps



回答4:

I figured out a way to do this. Create a shortcut of the .bat/.cmd file. Right click on the shortcut and go to Properties. Go to Advanced and select "Run as administrator".

After you do this, create another bat file that runs the shortcut of the original bat file. Then add this new bat file to task scheduler.



回答5:

See screenshot below Change to SYSTEM user



回答6:

I was stuck in the same problem, but the reason was different.

When moved the Utility from QA to Production and it was unable to run on Prod. I identified that reason was the .Net Framework Version.

The .Net Framework on Prod was 4.0 and the app was developed on .Net Framework 4.5.

I changed the Version of application and it started running flawlessly.

Hope this will help.