It is often useful to extract a list of the hostnames of servers that are running ITM Agents for processing by command files or scripts or the for command. Although the hostname of a server is embedded in the ITM agent name, the ITM commands will always return the full agent name, and not just the hotsname.
On Windows, it is possible to use the built-in for command to extract the hostname for all agents, as follows:
First log-in to the tacmd environment:
tacmd login -s <tems_hostname> -u <user_name>
Secondly, use the ITM command tacmd listsystems to list the desired agents, and parse with the Windows command for to extract the hostnames:
@for /F "delims=: tokens=2" %i in ('tacmd listsystems -t NT') do @echo %i
The -t option for tacmd identifies the ITM agent product code, in the above example NT is used for the Windows OS Agent.
To use this syntax within a command file, add an additional % to the vairiable %i, for example:
@for /F "delims=: tokens=2" %%i in ('tacmd listsystems -t NT') do @echo %%i