Enabling and disabling a server

Unlike the starting and stopping of a server, which does not require you to commit changes to the APS, enabling or disabling a server does. Once you have the Server object, you can enable or disable a server by toggling the Disabled flag. For example, the following code enables a server.

var Servers = IStore.Query("SELECT SI_NAME, SI_SERVER_IS_ALIVE, SI_DISABLED FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerId);

var ServerInfoObject = Servers.Item(1);

var ServerObj = ServerInfoObject.PluginInterface("");

//Change the flag to enable the server.

ServerObj.Disabled=false;

// Commit the changes to the APS so that the server is actually enabled.

IStore.Commit(Servers);

Note that in this case, the server is only enable once you have committed the collection back to the APS.

Next: Getting server metrics.



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com