<?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[WMI query returns codes]]></title><description><![CDATA[<p dir="auto">Hi Victor,</p>
<p dir="auto">Some WMI queries return code numbers. For example, WMI.Query(root\CIMV2, Win32_Processor, Architecture) returns 0 for x86, 9 for x64. How to write a script which can transform the result ? Some example will be really helpful, as there are lot of queries which return code numbers. I am configuring the queries in DCI configuration.</p>
<p dir="auto">Thanks in advance,</p>
<p dir="auto">Ravi</p>
]]></description><link>https://forum.netxms.org/topic/6254/wmi-query-returns-codes</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 13:20:19 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/6254.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 04 Nov 2019 13:15:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WMI query returns codes on Tue, 12 Nov 2019 12:46:20 GMT]]></title><description><![CDATA[<p dir="auto">Thank you so much for all the info. I look forward for the 3.1 version.</p>
<p dir="auto">Thanks and best regards,</p>
<p dir="auto">Ravi.</p>
]]></description><link>https://forum.netxms.org/post/26924</link><guid isPermaLink="true">https://forum.netxms.org/post/26924</guid><dc:creator><![CDATA[ravi2904]]></dc:creator><pubDate>Tue, 12 Nov 2019 12:46:20 GMT</pubDate></item><item><title><![CDATA[Reply to WMI query returns codes on Mon, 11 Nov 2019 10:30:19 GMT]]></title><description><![CDATA[<p dir="auto">Support for WMI queries returning lists or tables will be made available in 3.1 version.</p>
]]></description><link>https://forum.netxms.org/post/26912</link><guid isPermaLink="true">https://forum.netxms.org/post/26912</guid><dc:creator><![CDATA[Filipp Sudanov]]></dc:creator><pubDate>Mon, 11 Nov 2019 10:30:19 GMT</pubDate></item><item><title><![CDATA[Reply to WMI query returns codes on Wed, 06 Nov 2019 15:15:57 GMT]]></title><description><![CDATA[<p dir="auto">Currently WMI subagent does not support data presentation as table or list, it just takes first from received values. We are planning to implement this at some point of time.</p>
<p dir="auto">Capabilities are stored as a bitfield in that long integer, here you can find which bit represents what capability: <a href="https://www.netxms.org/documentation/datadictionary-3.0/#t-nodes" rel="nofollow ugc">https://www.netxms.org/documentation/datadictionary-3.0/#t-nodes</a></p>
]]></description><link>https://forum.netxms.org/post/26894</link><guid isPermaLink="true">https://forum.netxms.org/post/26894</guid><dc:creator><![CDATA[Filipp Sudanov]]></dc:creator><pubDate>Wed, 06 Nov 2019 15:15:57 GMT</pubDate></item><item><title><![CDATA[Reply to WMI query returns codes on Tue, 05 Nov 2019 09:38:42 GMT]]></title><description><![CDATA[<p dir="auto">Thank you so much Filipp  and Victor. I added the script in the transformation and it is working fine. Great.</p>
<p dir="auto">Another query I had, some of the WMI queries return a list, for example, WMI.Query(root\CIMV2, select * from Win32_LogicalDisk, caption), will return the list containing all the drives i.e. C:, D:, E: etc. How can I address this ? Also, , is it possible anyway, to a different row in raw_dci_values for each of these,  like - Caption: C:, Free Space: 87982829 bytes.</p>
<p dir="auto">Secondly, in the Object details screen, we get the capabilities list, which displays what kind of device it is, e.g. Printer, Bridge, Router etc. I think this comes from the nodes table from the column capabilities. If it is so, how does the "capabilities" column represent the description, since it contains a long integer. Can you explain this to me ? I needed this info to display in a different screen.</p>
<p dir="auto">Thanks a lot.</p>
<p dir="auto">Best regards,</p>
<p dir="auto">Ravi</p>
]]></description><link>https://forum.netxms.org/post/26879</link><guid isPermaLink="true">https://forum.netxms.org/post/26879</guid><dc:creator><![CDATA[ravi2904]]></dc:creator><pubDate>Tue, 05 Nov 2019 09:38:42 GMT</pubDate></item><item><title><![CDATA[Reply to WMI query returns codes on Tue, 05 Nov 2019 09:03:14 GMT]]></title><description><![CDATA[<p dir="auto">Small addition: if you have lot of values to convert or they change frequently you may want to create mapping table on the server (via Configuration -&gt; Mapping Tables) and use NXSL function <strong>map</strong> (<a href="https://www.netxms.org/documentation/nxsl-3.0/#func-map" rel="nofollow ugc">https://www.netxms.org/documentation/nxsl-3.0/#func-map</a>) to map code to text.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/26875</link><guid isPermaLink="true">https://forum.netxms.org/post/26875</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Tue, 05 Nov 2019 09:03:14 GMT</pubDate></item><item><title><![CDATA[Reply to WMI query returns codes on Mon, 04 Nov 2019 17:05:59 GMT]]></title><description><![CDATA[<p dir="auto">So, transformation scripts, as well as other scripts in NetXMS are written in NXSL - custom scripting language. It's syntax is resembling C language syntax. Language documentation can be seen here: <a href="https://www.netxms.org/documentation/nxsl-3.0/" rel="nofollow ugc">https://www.netxms.org/documentation/nxsl-3.0/</a></p>
<p dir="auto">Here's a sample script:</p>
<pre><code>if ($1 == 9) {
  return "x64";
}
else if ($1 == 0)
{
  return "x86";
}
else
{
  return "unknown: ".$1;
}
</code></pre>
<p dir="auto">$1 is the raw value (after step 1 of transformation), so in this case it's either 0 or 9. Other variables are also available in the script, e.g. $node in the node object to which the DCI belongs to. $node-&gt;name would be the name of the node.</p>
<p dir="auto">You can use trace function to print debug information to server's log file, first parameter of trace is debug level on which the information is printed</p>
<pre><code>trace(0, $node-&gt;name)
</code></pre>
<p dir="auto">P.S. For me only the following syntax of the parameter worked on Win7:<br />
WMI.Query(root\CIMV2,SELECT * FROM Win32_Processor, Architecture)</p>
]]></description><link>https://forum.netxms.org/post/26872</link><guid isPermaLink="true">https://forum.netxms.org/post/26872</guid><dc:creator><![CDATA[Filipp Sudanov]]></dc:creator><pubDate>Mon, 04 Nov 2019 17:05:59 GMT</pubDate></item></channel></rss>