Back to Geneos FAQ

How can I capture username in a command?

In your command you will have to add an argument xpath: /geneos/client/runtimeParameters/@Username. This will get the username and you may pass this as a parameter.

There are a few XPaths available to capture info of the Active Console, they are:

As an example, below is a Putty command using the username to connect to a Unix server:

<command name="GW2_Putty_with_username"> <targets> <target>/geneos/gateway/directory/probe[wild(rparam(&quot;OS&quot;),&quot;Linux*&quot;)]/managedEntity[wild(@name,&quot;nysupsvr*&quot;)]</target> <target>/geneos/gateway/directory/probe[wild(rparam(&quot;OS&quot;),&quot;S*&quot;)]/managedEntity</target> </targets> <userCommand> <type>script</type> <runLocation>client</runLocation> <args> <arg> <static>&quot;C:\Program Files\PuTTY\putty.exe&quot;</static> </arg> <arg> <xpath>ancestor::probe/parameters/@HostName</xpath> </arg> <arg> <static>-l</static> </arg> <arg> <xpath>/geneos/client/runtimeParameters/@Username</xpath> </arg> </args> </userCommand> </command>
["Geneos"] ["Geneos > Gateway"] ["FAQ"]

Was this topic helpful?