Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wsh, task scheduler please explain

Status
Not open for further replies.

wduty

Programmer
Jun 24, 2000
271
US
I am trying to set up a script to run once a day on NT running an IIS webserver. The script would do some complicated database cleanup. But before I do that I'm just trying to get a simple test script to run.

I go into "winnt/tasks/add scheduled task" and add a scheduled task usually to run in a minute or so. It evidently tries to run the script because I always get a "couldn't start task" message.

Thing is, I only have experience writing scripts in asp or browser context but not in a shell or scripting-host context. Is there something special I have to do to create a script to run in this context?

The script I am trying to run is in a file called scheduledtask.js and just contains the following two lines:
--------------------------------------------------
fs = new ActiveXObject("Scripting.FileSystemObject");
d = fs.createTextFile("c:\scheduletest.txt");


Why doesn't this work? Am I missing something? Can I not invoke Active-X like this from a shell script? What is the relationship between wsh and NT task-scheduler?

ANY HELP GREATLY APPRECIATED!
[sig]<p>--Will Duty<br><a href=mailto:wduty@radicalfringe.com>wduty@radicalfringe.com</a><br><a href= > </a><br> [/sig]
 
Does your program work when you call it from the command line? If not you should correct this. If yes it may be a problem with the scheduler account. Scheduled tasks are started form the TaskScheduler service that runs with the LocalSystem account. [sig][/sig]
 
sesth, thank you so much! The problem was entering the password for the admin account in the task schedule wizard. I don't know how I could have been so absentminded to just hit &quot;next&quot; on that window.

The test script now runs from the scheduler as expected and I can begin writing my actual database maintenance scripts. [sig]<p>--Will Duty<br><a href=mailto:wduty@radicalfringe.com>wduty@radicalfringe.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top