<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[execute command on management server - string not passed correctly]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">I'm struggeling to get the Action Configuration "execute command on management server" working as it should. I'd like to have the %m Message forwarded as a String to my script. What happens is that only the first word gets forwarded.</p>
<p dir="auto">My command:<br />
powershell C:\\NetXMS\\send_sms.ps1 \-recipients "00417xxxxxxxx" \-msg %m</p>
<p dir="auto">if i use "%m" nothing works also if i use single quotes. But if I use ' [%[get_first_parent]][%n] [%S]: [%[get_event_name]] ' it gets forwarded..</p>
<p dir="auto">The same behavior was discussed in the topic in 2011 but not solved:<br />
<a href="https://www.netxms.org/forum/configuration/parameters-with-spaces-on-execute-command-on-management-server/" rel="nofollow ugc">https://www.netxms.org/forum/configuration/parameters-with-spaces-on-execute-command-on-management-server/</a></p>
<p dir="auto">Where is my mistake?</p>
<p dir="auto">Thanks for your help!</p>
]]></description><link>https://forum.netxms.org/topic/3367/execute-command-on-management-server-string-not-passed-correctly</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 09:07:09 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/3367.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 Sep 2014 09:39:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Mon, 27 Oct 2014 08:40:30 GMT]]></title><description><![CDATA[<p dir="auto">Hi Victor,</p>
<p dir="auto">Thanks! Sounds really nice. We will upgrade as soon as we find time <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Kind regards,<br />
AP_ops</p>
]]></description><link>https://forum.netxms.org/post/15127</link><guid isPermaLink="true">https://forum.netxms.org/post/15127</guid><dc:creator><![CDATA[AP_ops]]></dc:creator><pubDate>Mon, 27 Oct 2014 08:40:30 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Thu, 16 Oct 2014 20:10:44 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I've added configuration option EscapeLocalCommands. If it is set to 1, tab, carriage return, and new line characters will be replaced by \t, \r, and \n in commands. It will be available in release 1.2.17.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/15059</link><guid isPermaLink="true">https://forum.netxms.org/post/15059</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 16 Oct 2014 20:10:44 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Mon, 06 Oct 2014 07:28:50 GMT]]></title><description><![CDATA[<p dir="auto">Hi Victor</p>
<p dir="auto">That would be a nice option. Thanks in advance! Please let us now when you have implemented this option.</p>
<p dir="auto">Best regards,<br />
AP_ops</p>
]]></description><link>https://forum.netxms.org/post/14980</link><guid isPermaLink="true">https://forum.netxms.org/post/14980</guid><dc:creator><![CDATA[AP_ops]]></dc:creator><pubDate>Mon, 06 Oct 2014 07:28:50 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Fri, 03 Oct 2014 15:36:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I probably can add an escape mode for all external commands executed by server, which will replace new line characters with \n and so on.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/14972</link><guid isPermaLink="true">https://forum.netxms.org/post/14972</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Fri, 03 Oct 2014 15:36:31 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Mon, 29 Sep 2014 08:09:06 GMT]]></title><description><![CDATA[<p dir="auto">Hi Victor,</p>
<p dir="auto">I know now how I could reformat all message texts to handover by commandline. But the option to avoid all /t /n characters is not the way with the least work as I use the formatted message texts mostly for messages by mail. Do you have any idea if it's possible to parse this characters in the script or if there is a way to solve this problem without building every message from scretch?</p>
<p dir="auto">thanks for help<br />
AP_ops</p>
]]></description><link>https://forum.netxms.org/post/14955</link><guid isPermaLink="true">https://forum.netxms.org/post/14955</guid><dc:creator><![CDATA[AP_ops]]></dc:creator><pubDate>Mon, 29 Sep 2014 08:09:06 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Mon, 22 Sep 2014 12:26:35 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I just found the reason...now its not NetXMS. One should know how to execute powershell from cmd environment. If you call a ps1 script fom cmd environment or in this case NetXMS you have to use "powershell <strong>-file</strong> -para "bla" -para2 "bla" " if no -file is used..just the first word is taken. It has to do with a security "feature"..</p>
<p dir="auto">thanks for your help!</p>
]]></description><link>https://forum.netxms.org/post/14932</link><guid isPermaLink="true">https://forum.netxms.org/post/14932</guid><dc:creator><![CDATA[AP_ops]]></dc:creator><pubDate>Mon, 22 Sep 2014 12:26:35 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Mon, 22 Sep 2014 11:31:43 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Alright I made the recommended changes: I removed all \n and \t characters. The Batchfile works now. After this success I just checked with a simple powerShell script:</p>
<pre><code>param(
       [String]$msg = $(throw "-msg is required.")
);

$error_log_path = "C:\log.txt"
"$(get-date) - "+ $msg | Out-File -Append $error_log_path
</code></pre>
<p dir="auto">I Just receive: "Zone:Comp" instead of<br />
"Zone:Comp XX NMS - 172.20.1.0/24System:[VM]Time:[22-Sep-2014 12:19:46]Severity:[Critical][TEST]isstopped!"</p>
<p dir="auto">The Line above is created through "Zone:%[get_first_parent]System:[%n]Time:[%t]Severity:[%S][%2]isstopped!" event config.</p>
<p dir="auto">Do you have any idea what could be the reason for that? Is is possible that the output is not a single string? Or the string is splitted in each space?</p>
<p dir="auto">Best regards,<br />
AP_ops</p>
]]></description><link>https://forum.netxms.org/post/14930</link><guid isPermaLink="true">https://forum.netxms.org/post/14930</guid><dc:creator><![CDATA[AP_ops]]></dc:creator><pubDate>Mon, 22 Sep 2014 11:31:43 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Mon, 22 Sep 2014 09:05:05 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I suppose that new line characters is the problem. I doubt that command line parser can handle them even inside quotes. Try to form message without new lines. If it helps, you can pass some other characters to indicate new lines and replace them in your script before sending SMS.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/14927</link><guid isPermaLink="true">https://forum.netxms.org/post/14927</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 22 Sep 2014 09:05:05 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Mon, 22 Sep 2014 08:56:52 GMT]]></title><description><![CDATA[<p dir="auto">Hello Victor</p>
<p dir="auto">Thx for your reply. I just tested if your test with the batch-file works in my configuration. It is exactly the same behaviour as with the powershell script... if I configure the action as:<br />
c:\\temp\\test.cmd parameter_1 "%m" it won't get executed. If I remove the "" from the %m (c:\\temp\\test.cmd parameter_1 %m) it gets executed but I just receive the first word. In my case "Zone:"</p>
<p dir="auto">Message form the event is configured as: Zone:\t%[get_first_parent]\nSystem:\t%n\nTime:\t\t%t\nSeverity:\t%S\n\n%2 is stopped!</p>
<p dir="auto">We have the version 1.2.13 running.</p>
<p dir="auto">Thx for help &amp; best regards<br />
Ap_ops</p>
]]></description><link>https://forum.netxms.org/post/14926</link><guid isPermaLink="true">https://forum.netxms.org/post/14926</guid><dc:creator><![CDATA[AP_ops]]></dc:creator><pubDate>Mon, 22 Sep 2014 08:56:52 GMT</pubDate></item><item><title><![CDATA[Reply to execute command on management server - string not passed correctly on Sun, 21 Sep 2014 08:28:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">"%m" should work, although I didn't test it specifically with powershell scripts. When I test it with the following cmd script:</p>
<pre><code>@echo off
echo %2 &gt;&gt; c:\temp\cmd.log
</code></pre>
<p dir="auto">and action configured as</p>
<p dir="auto">c:\\temp\\test.cmd parameter_1 "%m"</p>
<p dir="auto">file c:\temp\cmd.log contains records like</p>
<p dir="auto">"Node status changed to UNMANAGED"</p>
<p dir="auto">Note that cmd script interprets " as part of parameter. Can you create a simple powershell script which will just log all command line parameters it got?</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/14916</link><guid isPermaLink="true">https://forum.netxms.org/post/14916</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Sun, 21 Sep 2014 08:28:56 GMT</pubDate></item></channel></rss>