title: Exchange Powershell: Get-MailboxFolderPermission for all calendars
body: <p>I have been working on a script to display permissions for all mailboxes at once, for a certain user at a time. Unfortunately, since the -Identity attribute in the Get-MailboxFolderPermission command doesn't accept wildcards, this is getting a bit complicated and messy.</p>
  
  <p>I have started using an array to store all the mailboxes, so I can loop through it and run the command on each of them, but I've been unable to make this work because I haven't been able to reduce any of my outputs to just the email address. Here's my most recent iteration:</p>
  
  <pre><code>$Mailboxes = Get-Mailbox | Select Name -ExpandProperty EmailAddresses | Select AddressString
  $MailboxList = @()
  Foreach ($Box in $Mailboxes) {
      $BoxName = Out-String -InputObject $Box
      echo $BoxName | Out-File "box.txt"
      $BoxName = Select-String "box.txt" -Pattern "\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b"
      echo $BoxName
      $MailboxList += $BoxName
      }
  </code></pre>
  
  <p>The problem with this code is that the $BoxName variable comes back with "box.txt:4:" text attached to it. Attempts to remove that text with -Replace have resulted in a full filepath being added.</p>
  
  <p>I'm fairly new to Powershell, so even if this is just the entirely wrong approach, I would appreciate some pointers on how to do what I'm trying to do here.</p>
  
  <p>Thanks</p>