Symantec Connect
  • Login
  • Register
  • Endpoint Management & Virtualization
    • All of Connect
    • Backup and Archiving
    • Endpoint Management & Virtualization
    • Storage and Clustering
    • Security
    • Inside Symantec
    • Vision User Conference
    • Partners
    • Developers
    •  
  • Overview
  • Forums
  • Articles
  • Blogs
  • Downloads
  • Events
  • Videos
  • Groups
  • Ideas
Login to participate
Endpoint Management & Virtualization Community BlogRSS

Running VBS Scripts Through Software Delivery

snowjgj's picture
snowjgj
July 1st, 2007
Filed under: Altiris Client Management Suite, Altiris Server Management Suite, Endpoint Management & Virtualization Community Blog, Endpoint Management and Virtualization

I first noticed a problem when running a Software Delivery job using a Visual Basic script and the status of the tasks always showed "Run completed asynchronously". On closer inspection I noticed that the program was actually hanging in the background.

Read on to learn the steps I took to troubleshoot (and overcome) this problem.

Troubleshooting

To test, I set up a VB script to run as system account in a hidden window. I tested the file by double-clicking and watching it run through completely. A pop-up notified me of the success.

My command line for the program was:

wscript "myscript.vbs"

I had chosen wscript as this is Microsoft's default association.

The problem was that wscript is the GUI (graphic user interface) version of WSH. Most Windows operating systems default to using wscript when executing a script. Therefore, if you double-click a .vbs script, most likely it will run using the wscript.exe version of WSH. This will send all output directly to the screen in the form of message boxes. Alternatively, you can force the use of wscript by typing the following in a command prompt window:

wscript.exe scriptName.vbs 

The problem with this is that the output is sent to a GUI screen usually in the background and no return code is sent to the Altiris Agent until that window is closed. This window will not close without human intervention and the next time the computer restarts, a "Run completed asynchronously" status will show.

As there is quite a bit of output in the VBS script I did not want to have to edit the file to strip out all write lines.

Resolution

The resolution for this problem (that saved me a lot of time) is to use cscript. Cscript is the command-line version of WSH. cscript allows slightly more control over your scripts and is typically the preferred method for administrative scripts. You can use cscript by typing the following at the command prompt:

cscript scriptName.vbs 

Using cscript causes all output to be sent to the command prompt window, thus allowing you more control over the output, and prevents you from having to respond to every message that is displayed (which is the case when you use wscript). This will complete the program and send a exit code to the Altiris Agent.

After changing the command line to:

cscript "myscript.vbs"

I was able to have my job work as desired.

So if you desire to hide all output and run the VBS script hidden, you will need to use "cscript", however if you need the output from the VBS script to display for the user then use "wscript".

Hope this helps.

0 votes
  • snowjgj's blog
  • Login or register to post comments
  • Comments RSS Feed
tech9's picture
tech9
2 years 37 weeks ago

Cscript

I ran into the same problem when trying to authenticate when mapping network drives outside the domain.

Using cscript resolved that for me as well.

0 votes
  • Login or register to post comments
SK's picture
SK
2 years 37 weeks ago

WiseScript

You could always wrap the VBS in a wise script by using the Execute VBS Script function. This way, your SWD Package is now an EXE, and the script cannot be tampered with by the User.

0 votes
  • Login or register to post comments

Would you like to reply?

Login or Register to post your comment.

About Endpoint Management and Virtualization Community Blog

The Endpoint Management & Virtualization Community Blog is the perfect place to share short, timely insights including product tips, news and other information relevant to the Endpoint Management & Virtualization community. Any authenticated Connect member can contribute to this blog.
Filter by:

Recent Blog Posts

  • How to Install and Uninstall IBM Installation Manager using XML files
    WiseUser - March 18, 2010
  • Future Tech - Silverlight and phones (Altiris future mobiltity)
    Palvaran - March 16, 2010
  • Webcast - Redefining Endpoint Management with Altiris IT Management Suite 7.0 from Symantec
    ohzone - March 15, 2010
  • USB Swiss Army Knife: 7 Quick Fix
    riva11 - March 12, 2010
  • Cebit is over. What will be our next big show?
    erikw - March 12, 2010

Blog Tags

7.1 Agents Altiris Client Management Suite Altiris Deployment Solution Altiris IT Asset Management Altiris Notification Server Altiris Recovery Solution Altiris Server Management Suite Asset Management Suite Backup Exec Backup Exec System Recovery Basics Best Practice Beta CIO Digest Case Study Compatibility Configuring Customer Preview Customer Reference Database Dell Dell Management Products Demonstration Documentation Downloads Drivers Emerging Threats Endpoint Management and Virtualization Endpoint Protection (AntiVirus) Enterprise Vault Error messages Evaluating Features General Symantec Ghost Solution Suite HP Management Products Helpdesk Solution How to ITMS Industry Event Inside Symantec Installing Licensing Linux Local DS GURU Email group Mac OS ManageFusion Mobile & Wireless NetBackup New Release News News Performance Platforms & Hardware Problem Management Recovering Reporting Restore SP2 SecurityExpressions Service Pack 2 ServiceDesk Storage Foundation Symantec Connect Symantec Event TMS TechTips Tip/How to Tips/How To Training Troubleshooting Upgrade User Group VDI VMware Virtualization Virtualization Vision Vulnerabilities & Exploits Windows Windows Wise Application Packaging Wise Installation Development Wise Virtual Composer Workflow Solution Workspace Corporate Workspace Profiles Workspace Remote Workspace Streaming Workspace Virtualization XPF baltimore deployment hugo known_issue pcAnywhere solution webcast
© 2010
  • Symantec Corporation
  • Contact Us
  • Get RSS
  • Privacy Policy
  • Symantec.com