title: Need Help To Get XML Values In Array Using POWERSHELL
body: <p>I have an XML Output from a FIRMWARE CHECK Script on a HPE Server.
  I want to create an array to define <code>FIRMWARE_NAME VALUE</code> = <code>FIRMWARE_VERSION VALUE</code> for each index.</p>
  <p>As you can see that Path is not consistent and there can be more or less index from server to server, hence creating a loop fails, probably because I am not good with PowerShell too and hence seeking some help.</p>
  <p>A demo script is below:</p>
  <pre><code>$xml = [xml]@&quot;
  &lt;HEAD&gt;
  &lt;RIBCL VERSION=&quot;2.23&quot;&gt;
  &lt;RESPONSE
      STATUS=&quot;0x0000&quot;
      MESSAGE='No error'
       /&gt;
  &lt;GET_EMBEDDED_HEALTH_DATA&gt;
       &lt;FIRMWARE_INFORMATION&gt;
            &lt;INDEX_1&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;iLO&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;2.40 Dec 02 2015&quot;/&gt;
            &lt;/INDEX_1&gt;
            &lt;INDEX_2&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;System ROM&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;I31 06/01/2015&quot;/&gt;
            &lt;/INDEX_2&gt;
            &lt;INDEX_3&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;Redundant System ROM&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;I31 04/01/2015&quot;/&gt;
            &lt;/INDEX_3&gt;
            &lt;INDEX_4&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;Intelligent Provisioning&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;1.62.31&quot;/&gt;
            &lt;/INDEX_4&gt;
            &lt;INDEX_5&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;Intelligent Platform Abstraction Data&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;1.55&quot;/&gt;
            &lt;/INDEX_5&gt;
            &lt;INDEX_6&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;System ROM Bootblock&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;03/05/2013&quot;/&gt;
            &lt;/INDEX_6&gt;
            &lt;INDEX_7&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;Power Management Controller Firmware&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;3.3&quot;/&gt;
                 &lt;FIRMWARE_FAMILY VALUE = &quot;0Ch&quot;/&gt;
            &lt;/INDEX_7&gt;
            &lt;INDEX_8&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;Power Management Controller Firmware Bootloader&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;2.7&quot;/&gt;
            &lt;/INDEX_8&gt;
            &lt;INDEX_9&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;System Programmable Logic Device&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;Version 0x13&quot;/&gt;
            &lt;/INDEX_9&gt;
            &lt;INDEX_10&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;Server Platform Services (SPS) Firmware&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;2.1.7.E7.4&quot;/&gt;
            &lt;/INDEX_10&gt;
            &lt;INDEX_11&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;Smart Array P220i Controller&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;6.68&quot;/&gt;
            &lt;/INDEX_11&gt;
            &lt;INDEX_12&gt;
                 &lt;FIRMWARE_NAME VALUE = &quot;HP FlexFabric 10Gb 2-port 554FLB Adapter&quot;/&gt;
                 &lt;FIRMWARE_VERSION VALUE = &quot;10.5.155.0&quot;/&gt;
            &lt;/INDEX_12&gt;
       &lt;/FIRMWARE_INFORMATION&gt;
  &lt;/GET_EMBEDDED_HEALTH_DATA&gt;
  &lt;/RIBCL&gt;
  &lt;/HEAD&gt;
  &quot;@
  </code></pre>
  <p>EXPECTED OUTPUT: in the array</p>
  <blockquote>
  <p>iLO= 2.40 Dec 02 2015</p>
  <p>System ROM= I31 06/01/2015</p>
  <p>Redundant System ROM= I31 04/01/2015</p>
  <p>Intelligent Provisioning= 1.62.31</p>
  <p>Intelligent Platform Abstraction Data= 1.55</p>
  <p>System ROM Bootblock= 41338</p>
  <p>Power Management Controller Firmware= 3.3</p>
  <p>Power Management Controller Firmware Bootloader= 2.7</p>
  <p>System Programmable Logic Device= Version 0x13</p>
  <p>Server Platform Services (SPS) Firmware= 2.1.7.E7.4</p>
  <p>Smart Array P220i Controller= 6.68</p>
  <p>HP FlexFabric 10Gb 2-port 554FLB Adapter= 10.5.155.0</p>
  </blockquote>