我正在使用 Powershell 处理我的 Office 365 Exchange 实例,并且我知道我过去成功运行的命令遇到了问题。我已将此命令分解为其子部分并自行运行它们,但似乎无法使此 ForEach 循环正常工作。我可能在这里缺少什么?
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