Default language.

Information
Important This documentation space contains information about the on-premises version of BMC Helix Discovery. If you are using the SaaS version of BMC Helix Discovery, see BMC Helix Discovery (SaaS).

Future.runCommand


Future.runCommand(target, command, path_to_command)

Returns a DiscoveredCommandResult node containing the result of running the specified command. Enables command paths to be restricted.

Warning

The  function is similar to discovery-runCommand but has an additional parameter specifying the path to the command. The new parameter is intended to be merged with discovery-runCommand in a future release, and the  function deprecated.

Where command is the command to run.

The path_to_command parameter is the path to the command including the command itself, without arguments.

Where the function encounters short 8.3 format paths on Windows, it expands them to the full path. To determine the full path, it will run additional commands. 

Information

When running commands from patterns beware that there may be additional leading or trailing whitespace in the result. This can be removed using text.strip() if required.

The target node can be one of the following:

HostDiscoveryAccessDiscoveredDirectoryEntry
DiscoveredFQDNDiscoveredHBADiscoveredListeningPort
DiscoveredNetworkConnectionDiscoveredNetworkInterfaceDiscoveredProcess
DiscoveredSNMPRowDiscoveredWMISQLResultRow
DirectoryListingDiscoveredPackagesDiscoveredSNMPTable
DiscoveredWMIQueryFQDNListHBAInfoList
IntegrationResultInterfaceListNetworkConnectionList
ProcessListDeviceInfoDiscoveredCommandResult
DiscoveredFileDiscoveredPatchesDiscoveredRegistryValue
DiscoveredSNMPHostInfo 

The following table compares existing discovery.runCommand function call with their Future.runCommand equivalents:

Existing discovery.runCommandEquivalent Future.runCommandSource of example (TKU pattern module)
discovery.runCommand(
      process, "%process.cmd% -v");
Future.runCommand(process, "%process.cmd% -v", process.cmd);Acresso.FLEXnetPublisher
discovery.runCommand(
    host,
    '%install_root%%sep%bin%sep%activemq --version');
 
Future.runCommand(
      host,
      '%install_root%%sep%bin%sep%activemq --version',
      "%install_root%%sep%bin%sep%activemq");
 
Apache.ActiveMQ
discovery.runCommand(
 host,
'(. %install_dir%/sqllib/db2profile && db2 list node directory)');
 
Future.runCommand(
      host,
      '(. %install_dir%/sqllib/db2profile && db2 list node directory)',
      '%install_dir%/sqllib/db2profile');
 
 IBM.DB2.RDBMS
jenkins_cmd := '%process.cmd% -jar %jenkins_war_file% --version';
jenkins_version := discovery.runCommand(host, jenkins_cmd);
 
jenkins_cmd := '%process.cmd% -jar %jenkins_war_file% --version';
jenkins_version := Future.runCommand(
      host,
      jenkins_cmd,
      [process.cmd, jenkins_war_file]);
 
OpenSource.Jenkins
version_command := "cmd /c %install_root%\\etc\\iw.tssearch -v";
version_output := discovery.runCommand(host, version_command);
 
version_command := "%install_root%\\etc\\iw.tssearch";
version_output := Future.runCommand(
      host,
      "%version_command% -v",
      version_command);
 
Autonomy.InterwovenUniversalSearch
Warning

Possible post-processing required on UNIX/Linux hosts

When a pattern executes a command on a UNIX/Linux host, the result returned can contain control characters used to display colours and other formatting. The pattern should not rely on being able to use the result without some additional processing such as regular expression matching and extraction.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC Helix Discovery 25.2 (On-Premises)