Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Executing VBScript file on clients via SMP Task

Created: 04 Jun 2012 • Updated: 05 Jun 2012 | 3 comments
This issue has been solved. See solution.

 

 

I've been trying to execute a vbscript file from the local client computer by using a "Run Script" task, but everytime i run the task and check the task instance details, I see the following message under "Output Properties":

Script:  Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
C:\WINDOWS\TEMP\AltirisScript041B41208BA19A149C9DD.vbs(1, 11) Microsoft VBScript compilation error: Expected statement
 
If I go into the task's advanced properties and uncheck the box for "Save script output with task status" and run the job again (it does fail) and I receive a return code of "1".
 
Of course, if I run the VBScript from the client machine locally it works like a charm. No problems. Can anyone help me understand what's happening and perhaps how best to troubleshoot it?
Thanks!
 
 

 

 

 

Comments 3 CommentsJump to latest comment

Zac H's picture

Does the script require network access?  If so, the SYSTEM account it normally runs under isn't allowed to access the network.

davidhilling's picture

Id go with zac, what you normally see is that a vbscript will be calling a unc path but trying to run as system. Run it with an account with access to the share and admin rights on the machine and it will probably be fine. 

Greg2105's picture

I tried changing the account that the task runs under earlier this morning, but I was still having the  compilation" error.  I believe the way i was calling the vbs file was incorrect. Originally, I was executing this in the task's script editor window:

cscript.exe "c:\myFolder\myVBSfile.vbs"

I got it to work by changing it to the following:

 

Set oWsh = CreateObject("WScript.shell")
oWsh.Run("c:\myFolder\myVBSfile.vbs", 0, True)
 

Once that worked, I dressed it up a bit to pass the response/error codes to the executing task:

 

Dim oWsh, response
Set oWsh = CreateObject("WScript.shell")
response = oWsh.Run("c:\myFolder\myVBSfile.vbs", 0, True)
wscript.quit(response)
 
But what do you know... THEN I had an issue with the account it was running under! So thanks for the advice, it really helped.
SOLUTION