<?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[Exchange Build number (long format)]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">After Update to Version 4.X the old dosent work</p>
<p dir="auto">Netxms config:<br />
ExternalParameter = EXVersion:"C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" "C:\Script\EXVersion.ps1"<br />
Script: Get-Command Exsetup.exe | ForEach FileVersionInfo |fl Productversion</p>
<p dir="auto">No Version Information.</p>
<p dir="auto">After Searching i use this:</p>
<p dir="auto">ExternalParameterShellExec = ExchangePatchNumber:pwsh -Command { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }</p>
<p dir="auto">Value: forEach' is not recognized as an internal or external command</p>
<p dir="auto">Debug log:<br />
2022.05.20 13:11:46.415 *D* [exec               ] RunExternal called for "ExchangePatchNumber" "Spwsh -Command { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }"<br />
2022.05.20 13:11:46.415 *D* [exec               ] RunExternal: command line is "pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }"<br />
2022.05.20 13:11:46.423 *D* [procexec           ] ProcessExecutor::execute(): process "CMD.EXE /C pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }" started<br />
2022.05.20 13:11:46.467 *D* [procexec           ] ProcessExecutor::readOutput(): stopped on GetOverlappedResult (The pipe has been ended.)<br />
2022.05.20 13:11:46.467 *D* [comm.cs.1          ] GetMetricValue("ExchangePatchNumber"): 0 (SUCCESS) value = "'ForEach' is not recognized as an internal or external command,"</p>
<p dir="auto">If I understand correctly then he leaves the variable $ ( 022.05.20 13:11:46.423 *D* [procexec           ] ProcessExecutor::execute(): process "CMD.EXE /C pwsh -Command { Get-Command Exsetup.exe | ForEach {_.FileVersionInfo} }" started) out and that's why the error occurs?</p>
<p dir="auto">In Powershell the Command works</p>
<p dir="auto">Any ideas about it?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.netxms.org/topic/7386/exchange-build-number-long-format</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 13:09:01 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7386.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 May 2022 11:34:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Exchange Build number (long format) on Tue, 24 May 2022 07:36:28 GMT]]></title><description><![CDATA[<p dir="auto">Not each output of powershell begins with empty line, only this specific command does. You can filter output further, probably from powershell itself as well, but I don't know how (not using it). However, command line pipe should work as well (I assume you are interested in line with version number):</p>
<pre><code>ExternalParameterShellExec = ExchangePatchNumber:pwsh -Command { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} } | find "ExSetup.exe"
</code></pre>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/31437</link><guid isPermaLink="true">https://forum.netxms.org/post/31437</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 24 May 2022 07:36:28 GMT</pubDate></item><item><title><![CDATA[Reply to Exchange Build number (long format) on Mon, 23 May 2022 15:15:46 GMT]]></title><description><![CDATA[<p dir="auto">OK but powershell output beginns ever wither a blank line i have no idea how do i get rid of that</p>
]]></description><link>https://forum.netxms.org/post/31430</link><guid isPermaLink="true">https://forum.netxms.org/post/31430</guid><dc:creator><![CDATA[Thomas]]></dc:creator><pubDate>Mon, 23 May 2022 15:15:46 GMT</pubDate></item><item><title><![CDATA[Reply to Exchange Build number (long format) on Mon, 23 May 2022 12:33:05 GMT]]></title><description><![CDATA[<p dir="auto">Yes, only first line is taken as value of external parameter. You have to format output in your script so it return required value in first line.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/31428</link><guid isPermaLink="true">https://forum.netxms.org/post/31428</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 23 May 2022 12:33:05 GMT</pubDate></item><item><title><![CDATA[Reply to Exchange Build number (long format) on Mon, 23 May 2022 12:15:11 GMT]]></title><description><![CDATA[<p dir="auto">Hello Victor,</p>
<p dir="auto">Thanks for your answer.. This woks..</p>
<p dir="auto">But in NetXMS the Value is emty....</p>
<p dir="auto">Log:<br />
2022.05.23 14:07:23.515 *D* [procexec           ] ProcessExecutor::execute(): process "CMD.EXE /C powershell -Command "&amp; { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }"" started<br />
2022.05.23 14:07:23.746 *D* [procexec           ] ProcessExecutor::readOutput(): stopped on GetOverlappedResult (The pipe has been ended.)<br />
2022.05.23 14:07:23.746 *D* [comm.cs.1          ] GetMetricValue("ExchangePatchNumber"): 0 (SUCCESS) value = ""</p>
<p dir="auto">CMD out:<br />
C:\&gt;CMD.EXE /C powershell -Command "&amp; { Get-Command Exsetup.exe | ForEach {$_.FileVersionInfo} }"</p>
<p dir="auto">ProductVersion   FileVersion      FileName<br />
--------------   -----------      --------<br />
15.02.1118.007   15.02.1118.007   D:\Program Files\Microsoft\Exchange Server\V15\bin\ExSetup.exe</p>
<p dir="auto">Is the problem here that only the first line is output and the value is actually in the 3 line?<br />
Do you have an idea how I can fix this?</p>
]]></description><link>https://forum.netxms.org/post/31427</link><guid isPermaLink="true">https://forum.netxms.org/post/31427</guid><dc:creator><![CDATA[Thomas]]></dc:creator><pubDate>Mon, 23 May 2022 12:15:11 GMT</pubDate></item><item><title><![CDATA[Reply to Exchange Build number (long format) on Sun, 22 May 2022 16:28:33 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">you should use $$ to insert $ into command, as it is start of command argument ($1, $2, etc.).</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/31421</link><guid isPermaLink="true">https://forum.netxms.org/post/31421</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Sun, 22 May 2022 16:28:33 GMT</pubDate></item></channel></rss>