title: Combine powershell commands
body: <p>Guys I have this unique problem and have been stomping my head for answers. I basically have two good running scripts but I need to combine them. For some reason this is not working and I am getting all types of syntax powershell errors.</p>
  
  <p>1st script which works correctly. Please see below for the second script</p>
  
  <pre><code>Get-Content c:\list.txt | foreach {
      Get-Mailboxstatistics -id $_ | foreach{
          $mbx = $_ | select DisplayName, @{Label=’MailboxSize("MB")’;Expression={$_.TotalItemSize/1MB}}, ItemCount
          $date_captured=get-date | select datetime
  
          Get-Mailbox -id $_ | foreach{
              $mbx | add-member -type noteProperty -name Alias -value $_.Alias
              $mbx | add-member -type noteProperty -name ServerName -value $_.ServerName
              $mbx | add-member -type noteProperty -name ProhibitSendReceiveQuota -value $.ProhibitSendReceiveQuota 
              $mbx | add-member -type noteProperty -name UseDatabaseQuotaDefaults -value $.UseDatabaseQuotaDefaults 
              $mbx | add-member -type noteProperty -name IssueWarningQuota -value $_.IssueWarningQuota
          } $mbx, $date_captured
  
      }
  
  }
  </code></pre>
  
  <p>Here is the second command that runs. This works great by itself and again trying to </p>
  
  <p>combine this with the command above this fails.</p>
  
  <pre><code>get-mailboxfolderstatistics -id "alias" | select name, foldersize, itemsinfolder
  </code></pre>
  
  <p>Now what I am trying to accompish is to get my output to something like this below.</p>
  
  <blockquote>
    <p>DisplayName               MailboxSize("MB")         ItemCount<br>
    Alias                     ServerName<br>
    ProhibitSendReceiveQuota  UseDatabaseQuotaDefaults  IssueWarningQuota </p>
    
    <p>DateTime : Tuesday, April 10, 2012 4:04:28 PM</p>
    
    <p>Name          Foldersize  Itemsinfolder topofinfromationstore 0       3 calendar<br>
    1234      54 inbox            1024785     241 sent items      14745       54               deleted
    items     5414745     875</p>
  </blockquote>