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!

VBS script won't start (schedule task)

Status
Not open for further replies.

pxm148

Programmer
Jan 6, 2005
12
CA
Hi, I have a problem with my VBS.
It's a vbs that goes and get a web page download the content and save it in a file.
It's working great when I run it manually, but when I use task manager on WinNT4 the VBS starts but then hang until I un lock the machine and login.
It seem that when the machine is lock or as sleep the vbs won't run properly.
Any idea?
 
Try creating a Batch file that calls the VBScript. Set Task Scheduler to run the batch file instead. If it is in the same directory as the VBS file then the batch file can simply be:
myFile.bat
Code:
myFile.vbs

Tony
_______________________________________________________________
 
Or better yet...

the area that calls the .vbs script, type this instead:
cscript yourscript.vbs //b //nologo

-SWarrior
 
Let me clerify.....

Within your scheculed task, instead of:
c:\yourpath\yourscipt.vbs
use this:
"cscript c:\yourpath\yourscript.vbs //b //nologo"

-SWarrior
 
hey guys, it doesn't work. The script starts and doesn't do nothing until I get on the machine hit ctrl-Alt-del and login. Then I can see it start running...

The script access a web site that need authentification through an Apache popup. Everything works fine when I lauch the vbs buy right clicking the task and select "Run".
 
Try going into the settings tab in the New Task window and select "Wake the computer to run this task"

Also, be sure it's set to run under the correct security context.

Good luck...
 
This is exactly what I have put in:
cscript GetLogFile.vbs //b //nologo

I did look into the task property but there is no "wake the computer to run this task" option..
 
Here is the exact line:
cscript GetLogFile.vbs //b //nologo

I did check on the property of the task but "Wake the computer to run this task" doesn't seem to be any where.
The security context is fine as I can run the task by right clicking it.

 
pxm148,

When you do the 'cscript GetLogFile.vbs //b //nologo' you need to include the path location of the file.
for example:
cscript c:\Scripts\GetLogFile.vbs //b //nologo

IF you have a space in the path, then you'll need to do it like this:
cscript "C:\Program Files\Scripts\GetLogFile.vbs" //b //nologo

-SWarrior
 
I had a similar problem on Windows 2003; this may help you.
I was running the script with a user that had no admin rights, so I had to explicitly give this user 'write' access to cmd.exe found in \Windows directory (it may be \Windows\system32 I can't remember).
So, if your script is running as other than an admin, you may want to look at your event logs and check for any events related to your scheduled task.

Hope this helps.
 
Hey guys,

The user has admin right for sure. The script starts it just hang until I unlock the machine. When I unlock the machine I can see that the script is started but it's only then that it resume his task. The script opens 2 browser windows, one for loging activity and the other to get the page to download. When I unlock the machine I can see both windows opened and I can see in my log browser window that the script is started, but it's hanging and as soon as I unlock the machine it start working.

I think it maybe related with the computer been in sleep mode. I have winNT4 so the option to "Wake the computer to run this task" is not available in task scheduler.
Is there a way to update the task scheduler with a newer version?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top