Configuring the Windows Command adapter

In addition to targets defined in the adapter configuration, the Windows Command adapter can have dynamic targets defined in each adapter request. If a dynamic target will always be defined in the Windows Command adapter request, a configuration node of <config/> can be used in the adapter configuration. BMC recommends that you do not include unused elements in the adapter configuration because they might cause errors.

The remote service starts once you provide the credentials in the adapter configuration or request depending on the access rights.

The Windows Command adapter configuration supports the SSH functionality along with the xCmd utility. With the SSH functionality, a non-administrator user can execute commands on the remote computer if the SSH server is installed and running on the target computer.

Note

The default port for SSH is 22.


Adapter type: ro-adapter-windows-command_vv.rr.nn

Default adapter name: WindowsCommandAdapter

To configure the Windows Command adapter, see Configuring base adapters.

The following table describes the adapter configuration elements for the Windows Command adapter that you can specify by using the form view, XML view, or both. You cannot use the form view to configure elements and attributes that do not have an entry in the "UI label" column.

Configuration node elements for the Windows Command adapter

UI label

Element

Description

Required

Target

<target>

Specifies the host name or the IP address of the remote host

Default value: localhost

No

User Name

<user-name>

Specifies the user name to be used for remote host authentication

You must have an administrator role and privileges on the remote host.

Conditional; required based on your environment

Password

<password>

Specifies the password that corresponds to the <user-name> provided or that is used for remote host authentication

This element can contain an encryption-type attribute.

Conditional; required based on your environment

Encryption Type

<encryption-type>

Indicates whether the password specified is encrypted; is an attribute of the <password> element, not an element itself

Valid values: Base64, Plain (default)

No

Character Set

<character-set>

Specifies the supporting CharSet

Also called character set, it includes identifiers describing a series of universal characters.

Note

The locale and character set of the target computer must be compatible with the character set provided in the <character-set> element to get the desired results.

No

Logon With User Credentials

<logon-with-user-credentials>

Starts a service on the remote computer

  • Set <logon-with-user-credentials> to true to start the remote service using the credentials specified in the adapter configuration.
  • Set <logon-with-user-credentials> to false, to start the remote service using the SYSTEM credentials on the remote server.

    Valid values: true, false (default)

    Note

    To start a service on the remote computer, you must set the rights for the user name specified in <user-name> to Log on as a service. Use the Microsoft Windows Local Security Policy tool to set the user name rights.

No

Executable Directory

<executable-directory>

Specifies the complete path to the directory in which the .exe is located

This element is applicable in the default mode only

Default value: $AO_HOME/server/<Grid>/library/adapters/ro-adapter-windows-command-version

No

Executable

<executable>

Specifies the program to be used to execute the command

This element is applicable in default mode only.

Default value: xCmd.exe

No

Escape Double Quotes

<escape-double-quotes>

Escapes the double quotes (") by using a double backslash in the command

This element is applicable in default mode only.

Valid values: true (default), false

No

Protocol

<protocol>

Decides whether the command is routed through the xCmd tool or ssh

Valid values: default (default), ssh

Notes

  • If you provide a value other than default and ssh for <protocol>, the grid log will contain a warning.
  • If you provide ssh as the value for <protocol>, the ssh utility will be used for remote command execution.
  • If you provide default or any other value (other than ssh) for <protocol>, the xCMD tool will be used for remote command execution.

No

Script File Path

<script-file-path>

Specifies whether the path to the script file is relative to the local (peer) or the remote (target) computer

This element is applicable to the xCmd utility only.

Valid values:

  • local (default): Copies the specified script from the local peer to the remote computer and then executes the script
  • remote: Executes the script that exists on the remote computer

    For examples of <script-file-path> usage and relative and absolute paths, see Windows Command adapter requests.

No

Max Request Queue Size

<max-request-queue-size>

Specifies the maximum size of the queue maintained by the adapter to handle concurrent requests

Default value: 65535

Conditional

Debug Utility

<debug-utility>

Specify whether xCmd run in debug mode or non-debug mode

If the value is set to be true, the utility(xCmd) runs in debug mode.

Valid values: true, false (default)

No

Impersonate User<impersonate-user>

Specifies whether to enable the user impersonation and allow the specified user to execute tasks by using the security context of another user (For example, BAO service running under a user account)

For example, a service running as LocalSystem could access network resources by impersonating a specific user account. This account would have been configured with the necessary permissions to access a network resource, something the service would not be able to do otherwise.For more information about how user impersonation works, see Impersonation

If set to true, the Service Control Manager (SCM) API is invoked with the user specified in the adapter request or configuration.

By default, the xCmd utility runs under the security context of the BAO service running under a user account. When we specify <impersonate-user> as true, the SCM API is invoked with the user specified in the adapter request or configuration.

Valid values: true, false (default)

No
Service Launch Mode<service-launch-mode>

Specifies the mode to launch the xCommand service on a remote system

By default, the xCommand utility is launched on 32-bit mode.

Valid value: 64-bit

Note

Specify 64-bit only if you want to launch the xCommand service on a 64-bit image mode on the target system.

BMC recommends that you do not specify any value if 64-bit is not required as it can affect the time taken for the request to execute.

No

The following figure shows an XML template for the Windows command adapter configuration.

XML template of the Windows command adapter configuration

<config>
   <target></target>
   <user-name></user-name>
   <password encryption-type=""></password>
   <logon-with-user-credentials></logon-with-user-credentials>
   <protocol></protocol>
   <executable-directory></executable-directory>
   <executable></executable>
   <escape-double-quotes></escape-double-quotes>
   <protocol></protocol>
   <script-file-path></script-file-path>
   <character-set></character-set>
   <max-request-queue-size></max-request-queue-size>
   <debug-utility></debug-utility>
</config>


The following figure shows an XML sample for the adapter configuration for the Windows Command adapter using the xCmd utility.

XML sample of the Windows command adapter configuration using the xCmd utility

<config>
   <target>abc2</target>
   <user-name>Administrator</user-name>
   <password encryption-type="Plain">test</password>
   <character-set>gb18030</character-set>
   <logon-with-user-credentials>true</logon-with-user-credentials>
   <protocol>default</protocol>
   <script-file-path>local</script-file-path>
</config>


The following figure shows an XML sample for the adapter configuration for the Windows Command adapter using the ssh utility.

XML sample of the Windows command adapter configuration using SSH

<config>
   <target>abc2</target>
   <user-name>Administrator</user-name>
   <password encryption-type="Plain">test</password>
   <character-set>gb18030</character-set>
   <protocol>ssh</protocol>
</config>

The following figure shows an XML sample for the adapter configuration for the Windows Command adapter when the <impersonate-user> is set to true.

XML sample for the adapter configuration for the Windows Command adapter when the <impersonate-user> is set to true

<config>
        <target>vm-yyy-w2k</target>
        <user-name>domain.local\domainuser1</user-name>
        <password>password</password>
        <protocol>default</protocol>
    <service-launch-mode>64bit</service-launch-mode>
    <logon-with-user-credentials>true</logon-with-user-credentials>
    <impersonate-user>true</impersonate-user>
</config>

The following figure shows the XML sample for the adapter configuration for the Windows Command adapter when the <service-launch-mode> is 64-bit.

XML sample for the adapter configuration for the Windows Command adapter when the <service-launch-mode> is 64-bit

<config>
        <target>vm-yyy-w2k</target>
        <user-name>domain.local\domainuser1</user-name>
        <password>password</password>
        <protocol>default</protocol>
    <service-launch-mode>64bit</service-launch-mode>
    <logon-with-user-credentials>true</logon-with-user-credentials>
    <impersonate-user>false</impersonate-user>
</config>

The Windows Command adapter supports the 64-bit Windows 2008 operating system. By default, the firewall is enabled on a 64-bit Windows 2008 computer, which disables the Internet Control Message Protocol (ICMP). If the adapter does not execute commands on the target computer after enabling the adapter (that supports a 64-bit Windows 2008 operating system), you must enable file sharing and the ICMP used by the xCmd.

Enabling custom logging

To enable custom logging for the adapter, you must specify a log file name. You can also provide additional parameters for logging.

Note

You must be using BMC Atrium Orchestrator Platform version 7.8 or later to use the custom logging feature. These parameters will be ignored in earlier versions of BMC Atrium Orchestrator Platform.

These parameters are available with supported adapter versions. See your adapter documentation for details.

  • Log File Name: Provide a name for the log file.
    This file will be stored in the AO_HOME/tomcat/logs directory. If Log File Max Backup Index value is greater than 0, the log file name is suffixed with the backup index. For example, if the parameter value is a.log, backup log files will have names, such as a.log.1, a.log.2.
  • Log File Size: Specify a size limit for the log file. 
    If the value specified for Log File Max Backup Index is greater than 0, when the specified size is reached, the current file is renamed with the suffix .1. Otherwise, the log file will be reset and over-written. The default value is 10MB. The available units are KiloBytes (KB), MegaBytes (MB) or GigaBytes (GB).
  • Log File Max Backup Index: Enter the maximum number of backup files allowed. The default value is 10.
  • Log File Append: Select this option to append new log information to the existing information in the file. If unselected, the file will be overwritten with new log information.
  • Log Level: Enter the logging level using one of the following choices:

    Logging level

    Description

    DEBUG

    The most detailed logging level; logs low-level messages, normal execution, recoverable erroneous conditions, and unrecoverable erroneous conditions

    INFO

    (default)

    Logs normal execution, recoverable erroneous conditions, and unrecoverable erroneous conditions

    WARN

    Logs recoverable erroneous conditions and unrecoverable erroneous conditions

    ERROR

    The least detailed logging level; logs only error conditions that are not usually recoverable

To enable the ICMP on the target computer

  1. Type netsh firewall set icmpsetting 8 enable on the Windows command line and press Enter to enable the ICMP on the computer.

To enable file sharing

  1. On the 64-bit Windows 2008 computer, navigate to Start => Network => Network and Sharing centre.
  2. On the Network and Sharing centre page, enable the File sharing option, and click Save to enable file sharing.
Was this page helpful? Yes No Submitting... Thank you

Comments