Powershell, CMD, WSH, VBS, BAT, and other Script Actions may not run as expected

  • 7000926
  • 27-Mar-2012
  • 13-Nov-2013

Environment

Novell ZENworks 10 Configuration Management
Novell ZENworks 11 Configuration Management

Situation

ZCM Bundle Script Actions may not work as expected for Powershell Scripts, Batch Files, WSH scripts, VBS Scripts or other scripts.

Resolution

Reconfiguring the Bundle Action to ensure script options are configured optimally, including script engine parameters.

Additional Information

When using a Script Action to define a Script, it is very important to ensure that the "Script File Extension", "Path to Script Engine", and "Script Engine Parameters" are all configured properly.
 
These are three settings are all combined to form the command syntax to execute the script.
If the extension is not set properly, the script engine will often reject the script as invalid.
If the script engine is not in the search path or given a fully qualified path, Windows may not be able to find the script engine and fail.
If the script engine parameters are not correct, then the script engine will likely not execute the script properly. 
For the CMD.exe script engine (Used for BAT and CMD scripts) it will not run properly if no parameter is given and generally the /c  is generally the correct parameter.
The Powershell.exe script engine generally requires the -file parameter to work properly, or it will generate a script not found error.
 
Another source of confusion is that scripts often run "hidden" and do not provide any direct user interface to the script itself, though processes launched by the script are visible.
Changing the "Wait before Proceeding to next action" settings may alter this default visibility of the script.
 
In ZCM 11.2, if "No Wait is selected" or "Wait for X Seconds" with the  terminate action unchecked, the script will generally show script output directly.
If "When action is Complete" or "Wait for X seconds" with the terminate action checked, the scripts output will generally not be visible.
Its possible that prior versions of ZCM have slightly different behavior regarding the visibility of scripts.
Novell is investigating an enhancement to provide administrators with more direct control over the visibility of scripts.
If more control is required immediately, then consider using a "Launch Windows Executable" bundle action which can also run, but not generate, script files.