Re: Run VBScript as Task in 32 Bit Mode
- From: "Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com>
- Date: Sat, 18 Jul 2009 00:55:53 -0400
There's no task scheduler forum, so you'll end up circling back to here. ; )
What I suspect is that one of the things you do in your script makes it hang when running scheduled, which is why I was suggesting using the event log to capture information. You don't need to insert logging statements everywhere to start checking it, even. If you simply insert 2-4 statements at critical points, you'll be able to bracket the location where the failure occurs and then focus on that.
What I suspect is that you have a problem when using a particular component or accessing a resource; it may occur because something else has blocking access to the resource (I'm assuming you don't have On Error Resume Next statements in the code; that widens the problem area a bit).
"Bernie" <bernie@xxxxxxxxxxxxxx> wrote in message news:uZup1K1BKHA.5780@xxxxxxxxxxxxxxxxxxxxxxx
Well, I made a copy of my script I useing to test and started removing items until I got a working combination. I how have;.
Option Explicit
WScript.Echo "Script running"
WScript.Echo "Script Complete"
I then turned my focus on the Scheduled Task settings and removed the 32 bit launch. It now just runs;
C:\Scripts\bdtest.vbs
Which is the above three line script. So this points to a Scheduled Task problem.
I change the target to execute to a batch file called test.bat with only the "dir" command in it. I right click on the tash in scheduler and select run. The bat file runs, I see the directory output in a command window. The command window closes, but the status in task scheduler continues to say run. So I have a task schedule problem for sure.
Thanks for your help Alex. It looks like I'm now in the wrong forum. I'll go in search of a Task Scheduler forum, hahaha.
Bernie
"Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com> wrote in message news:%23KZptXTBKHA.3732@xxxxxxxxxxxxxxxxxxxxxxxAnd you don't have a hint about where the error is showing up, of course, with that kind of result. Two possible ways to follow up on this:
(1) Post the script as-is (munging database passwords of course) so we can take a look at possible issues. That could be troublesome if it's lengthy, and it would be almost unmanageable unless all lines are less than 76 chars long since the script would get serious mangling.
(2) Insert some logevent statements in the script at specific locations so that you can get specific information dumped out to the event log. This should help localize where the scheduled task is running into problems. If you're not familiar with LogEvent, it's a method exposed by WScript.Shell. You'll need to supply it with an event type numeric (use 4 for Information) and with an argument that is a text string which will be logged. Events logged this way should show up in the Application log and will show WSH as their source.
Example:
Set WshShell = CreateObject("WScript.Shell")
WshShell.LogEvent 4, "script starting"
' do stuff
WshShell.LogEvent 4, "about to connect to database"
' do stuff
WshShell.LogEvent 4, "Finished with database connection"
I recommend inserting a line immediately before and after each individual point when you access a resource - file, database, even mapping a drive. This should tell us precisely where the problem is occurring.
"Bernie" <bernie@xxxxxxxxxxxxxx> wrote in message news:upnkvzIBKHA.5068@xxxxxxxxxxxxxxxxxxxxxxxI moved the script and it's support files to c:\scripts. I can still run the file from command prompt, but I could do that before. The hanging while running continues in the new location.
Bernie
"Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com> wrote in message news:u8thQPIBKHA.4336@xxxxxxxxxxxxxxxxxxxxxxxI suggest moving the script and any support files it uses to another location, with NO spaces in its path. The problem you're describing could come from anything from the task scheduler having stripped quotes from the path to a misinterpretation of the Program Files path based on bitness-specific redirection to permission errors due to tighter security on the version of Windows you're using. Alternatively, try re-checking this by running the script directly yourself and seeing whether it succeeds or not - and if so, where it fails.
"Bernie" <bernie@xxxxxxxxxxxxxx> wrote in message news:Oa9AtvFBKHA.3732@xxxxxxxxxxxxxxxxxxxxxxxI'm making some progress on this issue. I have the task setup with;
Program/script - %windir%\SysWOW64\wscript.exe
Add arguments - "C:\Program Files (x86)\Scripts\Birthday List.vbs"
The script does a db query, makes a list of birthdays, and sends it in an email. The script has worked for years in a SBS 2003 environment as a scheduled task.
I can right click on the task and select run. The script will run and the emal will be sent. The status in Task Scheduler stays at "Running" and
there are two entries in the History section. One for Action Completed and the other for Task Completed. Both have an Operational Code of 2. I couldn't find a exact listing of all the Operational Codes. DAGS shows may people repeating the same limited list of 3 or 4, but not a list showing (2). I found this;
http://msdn.microsoft.com/en-us/library/ms681382(VS.85).aspx
and some implications that these are the same errors. If that's true then my error is File Not Found. Hmmmmm.
I can maually run the script in both CMD from Start|Run and from Command Prompt with or without admin status and no errors detected. I'm using a command line of;
%windir%\SysWOW64\wscript.exe "C:\Program Files (x86)\Scripts\Birthday List.vbs"
Any suggestions or directions?
Thanks,
Bernie
"Bernie" <bernie@xxxxxxxxxxxxxx> wrote in message news:Onckt%23CBKHA.1340@xxxxxxxxxxxxxxxxxxxxxxxThanks to Mark and Alex I have all my scripts back working again on my SBS 2008 64 bit server. Because the database ODBC connection is only 32 bit, I have to run in 32 bit mode. On the old server all these scripts ran as scheduled tasks. Is there a way to run in 32 bit mode out of a Scheduled Task?
Thanks,
Bernie
- Follow-Ups:
- Re: Run VBScript as Task in 32 Bit Mode
- From: Bernie
- Re: Run VBScript as Task in 32 Bit Mode
- References:
- Run VBScript as Task in 32 Bit Mode
- From: Bernie
- Re: Run VBScript as Task in 32 Bit Mode
- From: Bernie
- Re: Run VBScript as Task in 32 Bit Mode
- From: Alex K. Angelopoulos
- Re: Run VBScript as Task in 32 Bit Mode
- From: Bernie
- Re: Run VBScript as Task in 32 Bit Mode
- From: Alex K. Angelopoulos
- Re: Run VBScript as Task in 32 Bit Mode
- From: Bernie
- Run VBScript as Task in 32 Bit Mode
- Prev by Date: Re: I need to MAP a drive to the local computer
- Next by Date: Re: User defined functions.
- Previous by thread: Re: Run VBScript as Task in 32 Bit Mode
- Next by thread: Re: Run VBScript as Task in 32 Bit Mode
- Index(es):
Relevant Pages
|