title: I am trying to automate adding mailbox permission with variables
body: <p>I am trying to run this script to add permissions to mailboxes. If I remove all of the variables it works fine .. but I really need to be able to automate this. the code is not accepting the values I have assigned to each of the variables. guessing it ahs something to do with that the code is using a variable inside another one.</p>
  
  <pre><code>$MB = MAILBOX
  $GR = GROUP
  $PR = PERMISION 
  
  ForEach($f in (Get-MailboxFolderStatistics $MB | Where { $_.FolderPath.Contains("/") -eq $True } ) )
  {
  $fname = '$MB:' + $f.FolderPath.Replace("/","\"); add-MailboxFolderPermission $fname -User $GR -AccessRights $PR
  Invoke-Command $fname
  Start-Sleep -Milliseconds 1000
  }
  </code></pre>
  
  <p>$MB Errors</p>
  
  <pre><code>The specified mailbox "$MB" doesn't exist.
      + CategoryInfo          : NotSpecified: (:) [Add-MailboxFolderPermission], ManagementObjectNotFoundException
      + FullyQualifiedErrorId : [Server=xxxxxxxx,RequestId=xxxxxxx,TimeStamp=5/31/2019
      9:50:08 PM] [FailureCategory=Cmdlet-ManagementObjectNotFoundException] CCB4481D,Microsoft.Exchange.Management.Sto
    reTasks.AddMailboxFolderPermission
  </code></pre>
  
  <p>$GR Errors</p>
  
  <pre><code>Cannot bind argument to parameter 'User' because it is null.
      + CategoryInfo          : InvalidData: (:) [Add-MailboxFolderPermission], ParameterBindingValidationException
      + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Add-MailboxFolderPermission
  </code></pre>
  
  <p>Any help pointing me in the right direction would be a huge help.
  Thanks</p>