CWScript - New for ConsoleWorks 4.5

From TDiWiki

Jump to: navigation, search

Version Info: ConsoleWorks 4.5 (or later) is required to use CWScripts. (not available on OpenVMS platform)

Contents

[edit] CWScripts Menu

CWScripts gives ConsoleWorks users the ability to create advanced Javascript-like action routines that provide entirely new levels of automation capability in ConsoleWorks. CWScripts can be accessed from the left navigation menu under TOOLS. The standard View, Add, and Edit menu options are available. In order to see a list of all the CWScripts you have available, select View to open the TOOLS: CWScripts: View window. From the View window you can run, copy, delete, or open any of your CWScripts as well as add new CWScripts. You can also add a new CWScript directly from the left-hand menu by selecting Add to open the TOOLS: CWScripts: Add window. You can select an existing CWScript to edit by using the "..." button on the Add window. Selecting Edit from the left-hand menu provides the same functionality as the Add option.

CWScripts is based on javascript and many of the rules and standards of javascript will be applicable. You can find information on the functions and resources available to write your own CWScripts in the CWScript User's Guide in Help Central.

[edit] Adding CWScripts

Whether you are creating a CWScript from scratch or implementing one you have found on our wiki, you will need to Add the CWScript to your ConsoleWorks invocation. You can do so by clicking on Add under CWScripts in the left-hand menu to open the TOOLS: CWScripts: Add window. Use the following instructions to Add your CWScripts:
1. Give your CWScript a unique name in the Name field.
2. The description field is optional but very useful for explaining to other users the purpose of your CWScript.
3. Select the Profile that has the level of access you want your CWScript to have.
4. Enter a timeout value in which ConsoleWorks will stop your CWScript from operating. This setting is useful for preventing a runaway or continuous looping condition. You can set the timeout to 0 for "never time out" but use this setting with caution!
5. Select the Run Type. (for more information on Run Type read below)
6. Input your CWScript in the Script Text box.
7. Click on the Save button. When the CWScript is saved its syntax is validated. If any errors are found, a message describing the errors will appear in a pop-up box. If there are no errors, the CWScript will be saved and ready to run.
Image:cwscripts_add.jpg

[edit] Running CWScripts

How your CWScript is run is controlled by the Run Type setting. To modify the Run Type, open the Run Type section of the TOOLS: CWScripts: Edit window. Checking any of the first three options ("Run as...") will allow your CWScript to be run as an Action. (for more information see Actions) The rest of the Run Type options control the ConsoleWorks components that your CWScript can be run on. You may choose as few or as many Run Type options as you desire. To run your CWScript on a component, right-click on a component that corresponds with the Run Type you have selected and choose your CWScript from the Run CWScript menu. CWScripts can also be run independently by right-clicking on the CWScript in the TOOLS: CWScripts: View window and selecting Run or from the TOOLS: CWScripts: Edit window by clicking on the Run button in the top right-hand corner. Running your CWScript independently will not provide the global object "action" that comes from being run on a component but can be useful for testing or generic CWScripts. (for more infomation see the CWScripts User's Guide in Help Central)


[edit] CWScripts Plugins

As of ConsoleWorks 4.6, CWScripts has several plugins available that add additional functionality. The plugins are installed when the ConsoleWorks server kit is installed, but they must be manually moved in order for CWScripts to access them. To access the plugins, you will need to log into a fully privileged account, such as ADMINISTRATOR or a member of the ADMINISTRATOR group, locate the plugin files (see Available Plugins section below) in the bin folder of the ConsoleWorks directory structure, and move them to the cwscripts folder in the invocation directory. Assuming your ConsoleWorks invocation was installed in the default location (if not modify the following instructions according to your installation location), the folders can be found in the following locations:

[edit] Copy From

Microsoft Windows:
C:\Program Files (x86)\TDi\ConsoleWorks Server\Bin

Linux:
/opt/ConsoleWorks/bin

Sun Solaris:
/opt/TDIcnwrks/bin

[edit] Copy To

Microsoft Windows:
C:\Program Files (x86)\TDi\ConsoleWorks Server\<invocation name>\cwscript

Linux:
/opt/ConsoleWorks/<invocation name>/cwscript

Sun Solaris:
/opt/TDIcnwrks/<invocation name>/cwscript

[edit] Available Plugins

The plugins have a file extension of .dll on the Windows platform and .so on the Unix platforms.
libPISMTP - The SMTP plugin allows you to specify the target mail server and addressing details in a CWScript that sends email. (see MAIL_SENDER)
libPICommand - The Command plugin enables a CWScript to run commands on the system. This plugin requires activation by the ConsoleWorks administrator.
libPISCP - The SCP plugin enables a CWScript to copy files to another system securely. This plugin requires activation by the ConsoleWorks administrator.

Check out the CWScripts Repository for example scripts that make use of these plugins.

[edit] CWScripts Repository

This page will act as a repository for useful CWScripts. If you have created your own CWScripts and would like to share them with other ConsoleWorks users, please send them to support@tditechnologies.com, and we will post them here.

[edit] CWScripts for Groups

These scripts are meant to be run on Groups. (Run Type = Run on Groups)
GROUP_ADDSCAN
GROUP_DELSCAN
GROUP_DISABLE
GROUP_ENABLE
GROUP_LABEL_EDIT
LOGGING_MODIFY

[edit] CWScripts for Scans

These scripts are meant to be run on Scans. (Run Type = Run on Scans)
SCAN_EDIT
AUTOACTIONEDIT

[edit] CWScripts for Consoles

These scripts are meant to be run on Consoles. (Run Type = Run on Consoles)
LOGGING_MODIFY

[edit] CWScripts for Events

These scripts are meant to be run on Events. (Run Type = Run on Events)
AUTOACTIONEDIT

[edit] CWScripts for Event Actions

These scripts are meant to be run on Event Actions. (Run Type = Run on Event Automatic Action, Event Acknowledge Action, Event Purge Action)
EXPIRE_UNUSED_ACCOUNTS
SCHEDULE_SCAN_DISABLE
SCHEDULE_SCAN_ENABLE
MAIL_SENDER

[edit] CWScripts for general use

These scripts are not meant to be run on their own but included in other CWScripts.
SCAN_FUNCTIONS

Personal tools