I am working on my Office 365 Exchange instance with Powershell and am having trouble with a command that I know I've run successfully in the past. I have broken this command down into its sub pieces and run them all fine on their own but just cannot seem to make this ForEach loop work. What might I be missing here?
PS C:\Users\bsigrist> ForEach ($Mailbox in (Get-Mailbox -RecipientTypeDetails UserMailbox))
{ $cal = $Mailbox.alias+":\Calendar" Set-MailboxFolderPermission -Identity $cal
-User Default -AccessRights LimitedDetails }
At line:1 char:108
+ ... cal = $Mailbox.alias+":\Calendar" Set-MailboxFolderPermission -Identi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'Set-MailboxFolderPermission' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordExcep
tion
+ FullyQualifiedErrorId : UnexpectedToken