Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


twheeldon
2009-07-09T21:18:54Z
I'm trying to convert about a dozen VBScript tasks from Windows Task Scheduler to VisualCron. I'm specifically concerned with capturing errors.

When I set up my first VBS to run as an "Execute Script" task I am able to capture the exact error message in the variable "Output (stderr)" and send it via email. Everything works great.

I have another VBS that requires domain credentials to output a file to a network share. The only way I could get that VBS to run is to set the job up as an "Execute" task running wscript passing my VBS as the parameter. I set the credentials to "Logon Type: Network Credentials Only". When I tried to run this same job as an "Execute Script" task my credentials would not work.

The problem I am running into is when I run the job as an "Execute" task and there is an error I am not able to capture the error. The job shows a status of "Running" and continues to run indefinitely.

I want to have the error handling of the "Execute Script" option but also need to access a network share. It does not seem that the "Network Credential Only" option is available for "Execute Script" tasks.
Sponsor
Forum information
Support
2009-07-09T21:40:22Z
Use a UNC path instead of logical drive G:\ -> \\servername\folder. Then use a Credential for the remote machine (G:\) - if you are working with local accounts - if you are working with domain accounts you can use any account that has access to G:
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-09T21:51:16Z
Thanks for the quick response.

I am using a UNC path and am trying to use a domain account. I also have other VBScripts that update Active Directory groups (for example) and need to use domain credentials.

I can't seem to get domain credentials to work with an "Execute Script" task. The credentials work when I changed to an "Execute" task with "Network Credentials Only".
Support
2009-07-09T21:53:27Z
Is it possible to test with a local admin on that remote machine?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-09T22:00:56Z
I am getting a "VBScript runtime error: Permission denied" error when I use the local credentials of the remote target server. I am able to log into that server with the same credentials.
Support
2009-07-09T22:32:32Z
Could it be something else you do in that script. If you create a very simple script that reads a file or similar on that server - just to verify.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-09T23:00:39Z
I changed the script to write the file locally and it worked. But I need the file on the network share so another user can pick it up.

I did try running the script with domain admin credentials and that did NOT work.

If I change the "Task Type" from "Execute Script" to "Execute" it works with the same credentials. I would really like it to run as "Execute Script" but don't understand why the credentials are not taking.

Thanks again for your help.
Support
2009-07-09T23:04:51Z
It sounds strange. But it is easy to use the Execute Task instead. Just use the full path to cscript.exe in the command and full path to your script in argument.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-09T23:15:28Z
I've done that. My problem is that if there is an error the "Execute" task does not capture it and the task just hangs. The "Execute Task" task will capture the error and return the error in the variable "Output (stderr)".

Being able to capture the error is fantastic and the main reason I am trying to move from Windows Task Scheduler to VisualCron.

Is there something you can recommend I try to get the "Execute" task to capture an error?
Support
2009-07-09T23:17:27Z
Are you sure you are using cscript.exe and not wscript.exe? Because wscript.exe popups a messagebox on error.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-09T23:26:10Z
I was using wscript and just tried cscript.

With cscript the task will complete if there are no errors. If I have an error VisualCron still flags the task as completing successfully.
Support
2009-07-09T23:29:18Z
It seems like you are using some custom error handling in your script. Normally you get the error. Try with just creating a new script with an error and you will receive it.

Another thing that supresses output is if you have checked "Use shell execute". This should be unchecked.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-10T00:10:00Z
VBScript really doesn't have any error handling which is part of the problem. I do not have shell execute checked. What is the difference between "execute script" and "execute"? That seems to be my sticking point. Everything works as I would like with "execute script" except my credentials are not passed correctly.
Support
2009-07-10T09:25:12Z
The main difference is the API:s we use.

I am not sure what you mean by that vbscript has not error handling. We can easily create a script that produces an error that is captured by VisualCron. But we know that there are some function that suppress errors like On error resume next or similar.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-10T15:24:48Z
I just mean there is no try-catch or anything like that in VBS.

VisualCron is capturing the errors beautifully when I configure the job as "Execute Script" but not as "Execute". My AD credentials are not working with "Execute Script" which is where I am having my issue.

The first two jobs I configured with VisualCron did not require AD credentials so everything was working wonderfully with "Execute Script".

Support
2009-07-10T15:35:25Z
Could you write a generic sample script that fails for you and then send it to us so we can test it here?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-10T15:51:10Z
You bet. This sample script worked when the file pointed to the C-drive. I changed it to point to the Z-drive which does not exist on the server I have VisualCron installed on.


I'm attaching a print screen of the task as it is configured in VisualCron in case I am doing something wrong. I also attached a print screen of the error I receive when I just double-click this script in Windows. In VisualCron the job runs successfully.

Thanks again for your help with this.



DIM fso, txtFile, txtoutFile


' Open the txt file for output
Set fso = CreateObject("Scripting.FileSystemObject")
' Output file with invalid drive
txtoutFile = "z:\GrandViewCollege_Dataload.txt"

Set txtFile = fso.CreateTextFile(txtOutFile, True)

txtFile.WriteLine ("This is a test")


txtFile.Close

twheeldon attached the following image(s):
Support
2009-07-10T16:25:20Z
We will do some tests. One question though. In your real world sample script you are not using logical drives like z:/ but UNC paths? Logical drives for network shares will fail.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-10T16:43:48Z
That is correct. We are using a UNC path. I was just trying to create a sample script that fails with this sample.
Support
2009-07-10T16:45:48Z
The reason why it not generates an error in Execute Task is because cscript.exe return no "real" error (which is a non-zero exit code). In Execute script Task we handle any execution as error if stderr is not nothing. We are doing a workaround just for scripts in the Execute script task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2009-07-10T17:09:38Z
We may have found something. We will try to do some more tests during the weekend and get back to you. Thank you for your patience.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
twheeldon
2009-07-10T17:10:53Z
That makes sense.

I changed the same sample script I sent you to write the file to a UNC path. If I run that script as an "Execute" task with my stored credentials it works. When I change that same task (without touching the script or credentials) to an "Execute Script" task and using the same credentials I get a "Permission Denied" error. I've attached print screens of both configurations.

Thanks

twheeldon attached the following image(s):
twheeldon
2009-07-10T17:13:34Z
Support wrote:

We may have found something. We will try to do some more tests during the weekend and get back to you. Thank you for your patience.



I appreciate you looking at this. When I don't need AD credentials your product is fantastic. So much better than Windows Task Scheduler. But a lot of our jobs require AD credentials to run.

Have a great weekend.
twheeldon
2009-07-16T21:00:26Z
Just curious if you had a chance to look at this some more.

Thanks.
Support
2009-07-16T21:06:02Z
Yes, we are working on this right now. It was more to do than expected. Hopefully we complete it today and can test it tomorrow before releasing it this weekend.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top