title: Value from one command as parameter to another command
body: <p>I am trying to figure out how to get a value from one command as a parameter to another command, and use the output of both in a single table.  Specifically I am using two cmdlets, <code>Get-Mailbox</code> and <code>Get-MailboxStatistics</code> (this is against an Exchange 2010 server).</p>
  
  <p>From <code>Get-Mailbox</code> I need the <code>DisplayName</code>, <code>UseDatabaseQuotaDefaults</code> and Database fields.  Added to this, I need to get from <code>Get-MailboxStatistics</code> the <code>TotalItemSize</code> and <code>StorageLimitStatus</code> fields.</p>
  
  <p>I can run each of these commands individually, but cannot figure out how to use the <code>DisplayName</code> value from <code>Get-Mailbox</code> fed into the Identity value for <code>Get-MailboxStatistics</code> command and then output the whole lot into a single table.</p>
  
  <p>I was trying something along these lines:</p>
  
  <pre><code>get-mailbox | ForEach-Object {write-host $_.DisplayName, $_.UseDatabaseQuotaDefaults, $_.Database, Get-MailboxStatistics $_.SamAccountName}
  </code></pre>
  
  <p>Instead of actually processing the <code>Get-MailboxStatistics</code> as a command it just display it as text.  How can I get PS to treat this as a command and not text for the <code>write-host</code> cmdlet?</p>