Get-MailboxPermission和Get-ADPermission命令不适用于Get-RemoteMailbox命令

时间:2018-07-19 15:30:54

标签: powershell exchange-server powershell-remoting

我正在尝试使用此命令,但是它不提供任何输出或错误

Get-RemoteMailbox | Get-MailboxPermission -user $user | Where {($_.AccessRights -like "FullAccess") -and -not ($_.User -eq "NT AUTHORITY\SELF")} | Select Identity,User

注意:我们拥有混合Exchange安装程序,同时具有本地和Office 365 Exchange

1 个答案:

答案 0 :(得分:1)

Get-MailboxPermission是一个On-Permise cmdlet,仅适用于OnPremise邮箱,而不适用于Remote-Mailbox,您应该连接到365 Remote Exchange Shell并从那里执行它:

$Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session -WarningAction SilentlyContinue -DisableNameChecking

然后:

Get-Mailbox | Get-MailboxPermission -user $user | Where [...]

注意:不要在OnPremise Exchange Server Shell上执行它,它将与现有的交换命令冲突...