Simply put, you cannot use LogAddMessageEx on the remote for this purpose. To return some data back from an agent and then optionally write it to the log you can use the following technique: On the master create 2 script type jobs and schedule one of them. The other job should have [no schedule] for the schedule. Let's call them for simplicity a "worker" and a "runner" jobs. Job "runner" is scheduled and all it does is to run the "worker" job remotely and then get some data from the remote. Here is a sample script for the "runner" job: Dim remote_message, string JobRemoteRun "worker", "agent name" GetRemoteVariable "agent name", "message", remote_message LogAddMessageEx "INFO", "id of worker job", "worker", remote_message Copy your current script to the "worker" job. In the script replace LogAddMessageEx with the following: Dim GLOBAL.message, string Set GLOBAL.message, "this is the message that you want to log" This sets value of the "message" global variable on the agent whose value is then retrieved by the "runner" job and written to the log on the master. : How to I use the LogAddMessageEx command to report back log entries to the : master log : when running a script on a remote agent? In the master log, all I get are : status : message stating that the job was successfully sent to the agent and returned.
|