title: Loop and Add Data to a Hashtable
body: <p>I am working with a software list, and the Import-Excel module (<a href="https://github.com/dfinke/ImportExcel" rel="nofollow noreferrer">Link</a>), trying to create a hash table of software name and version number, with each host exported as its own sheet.  I'm using the Export-MultipleExcelSheets cmdlet within the module.  </p>
  
  <p>Here is a sample of what my $Inventory variable looks like:</p>
  
  <pre>
  Count Name                      Group                                                                                                                                                                                                  
  ----- ----                      -----                                                                                                                                                                                                  
    103 10.105.122.27             {@{Host=10.105.122.27; Name=Update Rollup 10 for Exchange Server 2010 Service Pack 3 (KB3049853); Version=1}, @{Host=10.105.122.27; Name=Update Rollup 14 for Exchange Server 2010 Service Pack 3 (K...
    103 10.105.122.28             {@{Host=10.105.122.28; Name=Update Rollup 10 for Exchange Server 2010 Service Pack 3 (KB3049853); Version=1}, @{Host=10.105.122.28; Name=Update Rollup 14 for Exchange Server 2010 Service Pack 3 (K...
    119 10.105.76.221             {@{Host=10.105.76.221; Name=Update Rollup 10 for Exchange Server 2010 Service Pack 3 (KB3049853); Version=1}, @{Host=10.105.76.221; Name=Update Rollup 15 for Exchange Server 2010 Service Pack 3 (K...
    116 10.105.76.222             {@{Host=10.105.76.222; Name=Update Rollup 15 for Exchange Server 2010 Service Pack 3 (KB3184728); Version=1}, @{Host=10.105.76.222; Name=Update Rollup 16 for Exchange Server 2010 Service Pack 3 (K...
  </pre>
  
  <p>Here is the code I am trying to use:</p>
  
  <pre><code>    Foreach ($I In $Inventory)
      {
          $DataToGather.Add($I.Name, {$I.Group | Select-Object Name, Version})
      }
  
      Export-MultipleExcelSheets -Show -Autosize -Path "C:\Path\To\Software Inventory.xlsx" $DataToGather
  </code></pre>
  
  <p>I get no errors with this code but it results in 10 sheets with the same software list (I know these machines do not have the same exact software list).  </p>
  
  <p>Is there a better way do to what I'm doing?</p>