Basic Info:
I have a .bat file that gets executed by Windows Scheduled Tasks (on Win 2003 Server).
The .bat file calls a .vbs script.
The .vbs script moves a text file (which has its data already comma delimited - no quotes) from a drive on the server to a network drive and changes the extension to .csv.
The script then copies the .csv file to a subdirectory in that network drive.
Finally, the script emails the .csv file as an attachment.
Error checking occurs if the original text file is not located on the server and emails our group a notificaton.

The account used by Scheduled Tasks to execute the .bat file is an Admin account on the server.

The script always works Whenever I log into the server (using the same Admin account that is used by the

Scheduled Tasks) and double click the .vbs script or manually right-click on the Scheduled Task and select "Run".

Everything worked fine for three days in a row. I'm not aware of anything else that has changed. I have seen this happen before where a script works fine for a while, then for some reason, doesn't run for a while, and then starts to run fine again.

Problem:
It seems like the Scheduled Task is not executing the .bat file even though teh Scheduled Task indicates that it has executed for that day (after the file are there).

Any ideas?

could be the Scheduled task service is getting turned off. Look in your services and make sure its on. If it is off, turn it on, and if it gets turned off again you have a new place to look.

Here is what I just noticed:
One task is set to run at 10:58 AM, the other at 10:59 AM. I logged into the server just after 10:58 AM but before 10:59 AM. The 10:58 task showed that it it ran (but didn't do anything with the file). So I watched the server clock until 10:59. At 10:59 the task executed and the file was moved. Is there a windows permission that does not allow moving files from a server to another network drive unless that account is actually logged in?

Not that i know of, however if you go into the properties of the scheduel you can set who you want it to run as, domain\administrator then set password.

That has already been done. An admin account (the same one that I use to log into the server) is being used for the 'run as' part.

@Echo Off
Test Script
start c:\test.vbs
exit

sadly it would appear to be your vbs script. (yes/no)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.