【问题标题】:Adding Mailbox with Powershell through O365通过 O365 使用 Powershell 添加邮箱
【发布时间】:2020-01-09 04:03:09
【问题描述】:

remove-mailboxPermission 和 Add-MailboxPermission 存在问题。我收到以下错误:

Command Get-Mailbox 有效,但其余无效(注意:我已经编辑了我们的 DNS)

#PowerShell script to add access to an email and not map
Set-ExecutionPolicy RemoteSigned

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

Get-Mailbox davidb@aaa.com

Remove-MailboxPermission -Identity davidb@aaa.com -User AshleyD@aaa.com -AccessRights FullAccess

Add-MailboxPermission -Identity davidb@aaa.com -User AshleyD@aaa.com -AccessRights FullAccess -AutoMapping:$false


Remove-PSSession $Session

【问题讨论】:

    标签: powershell email office365


    【解决方案1】:

    “A term _____ 未被识别为 cmdlet 的名称...”错误可能具有误导性。如果您的语法正确,通常意味着您没有足够的权限来运行该命令行开关。

    您可以使用本指南找出运行每个 cmdlet 所需的特定权限: https://docs.microsoft.com/en-us/powershell/exchange/exchange-server/find-exchange-cmdlet-permissions?view=exchange-ps

    您可能想知道“为什么它不直接告诉我我没有权限?”当您了解为什么会出现此错误时,它会更有意义。请记住,您的会话看不到(因为缺少更好的术语)您没有权限的参数或命令行开关。因此,根据您尝试执行的操作,PowerShell 可能会告诉您“那不是有效的命令”或“那不是有效的参数”,而实际上这些是有效的命令和参数,如果您不这样做,您的会话将看不到它们'无权运行它。如果您在 O365 PowerShell 会话中连接到错误的 URI(例如合规 uri 而不是 Outlook uri),也会发生这种情况

    编辑:This site 表示您需要成为 “组织管理” 组的成员才能运行这些 cmdlet。

    【讨论】:

      猜你喜欢
      • 2021-03-10
      • 1970-01-01
      • 2011-05-26
      • 1970-01-01
      • 1970-01-01
      • 2018-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多