GROUP DISABLE

From TDiWiki

Jump to: navigation, search

This script is designed to disable all of the Consoles that belong to a Group. This script could be particularly useful for creating a maintenance window for certain devices on your system. All Consoles that are disables by this script will show a status of "Disabled as part of <groupname> group."

[edit] Script Properties

Name: GROUP_DISABLE
Description: This script will disable all of the consoles contained in a group.
Profile: CONSOLE_MANAGER
Timeout: 30 (seconds)

[edit] Run Type

Run on Groups

[edit] Script Text

// * Copyright 1999-2011 TDi Technologies, Inc. All rights reserved. *
// * The information in this software is subject to change without   *
// * notice and should not be construed as a commitment by TDi.      *
// * Created: 3/31/2011                                              *

if (action.type != "Group") {
  log("CONWRKS", "This script is intended to be run only on groups!");    // this script is intended to be run only on groups
} else {
  var groupName;
  var myGroup;
  var groupCons;
 
  groupName = action[action.type];     // get the name of the group the script was run on
  myGroup =Group.get(groupName);
  log("CONWRKS", "Script run from the " + groupName + " group.");

  // get the consoles that are a part of the group
  groupCons = myGroup.getConsoles();
  // (CW 4.6)
  //var sts={comment:"Disabled as part of "+groupName+" group"};
  // (CW 4.5)
  var sts={status:"Disabled as part of "+groupName+" group"};
  for (console in groupCons)
  {
    log("CONWRKS", "Disable the console: " + groupCons[console].name);
    if (!groupCons[console].isDisabled()) {
      groupCons[console].disable(sts);
    }
  }
}

back to CWScript_-_New_for_ConsoleWorks_4.5

Personal tools