通过 O365 使用 Powershell 添加邮箱
Adding Mailbox with Powershell through O365
remove-mailboxPermission 和 Add-MailboxPermission 有问题。我收到以下错误:
命令 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
错误 "A term _____ is not recognized as the name of a cmdlet..." 可能会产生误导。如果您的语法正确,通常意味着您没有足够的权限 运行 该命令行开关。
您可以使用本指南找出您需要运行每个 cmdlet 的特定权限:
https://docs.microsoft.com/en-us/powershell/exchange/exchange-server/find-exchange-cmdlet-permissions?view=exchange-ps
您可能想知道 "why doesn't it just tell me that I don't have permission?" 当您理解为什么会出现此错误时,它就更有意义了。请记住,您的会话看不到(因为缺少更好的术语)您没有权限的参数或命令行开关。因此,根据您尝试执行的操作,PowerShell 可能会告诉您 "thats not a valid command" 或 "thats not a valid parameter",而实际上这些是有效的命令和参数,如果您没有访问权限,您的会话将看不到它们到运行吧。如果您在 O365 PowerShell 会话中连接到错误的 URI(例如合规性 uri 而不是 outlook uri),也会发生这种情况
编辑:This site 表示您需要成为 "Organization Management" 组的成员才能 运行 这些 cmdlet。
remove-mailboxPermission 和 Add-MailboxPermission 有问题。我收到以下错误:
命令 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
错误 "A term _____ is not recognized as the name of a cmdlet..." 可能会产生误导。如果您的语法正确,通常意味着您没有足够的权限 运行 该命令行开关。
您可以使用本指南找出您需要运行每个 cmdlet 的特定权限: https://docs.microsoft.com/en-us/powershell/exchange/exchange-server/find-exchange-cmdlet-permissions?view=exchange-ps
您可能想知道 "why doesn't it just tell me that I don't have permission?" 当您理解为什么会出现此错误时,它就更有意义了。请记住,您的会话看不到(因为缺少更好的术语)您没有权限的参数或命令行开关。因此,根据您尝试执行的操作,PowerShell 可能会告诉您 "thats not a valid command" 或 "thats not a valid parameter",而实际上这些是有效的命令和参数,如果您没有访问权限,您的会话将看不到它们到运行吧。如果您在 O365 PowerShell 会话中连接到错误的 URI(例如合规性 uri 而不是 outlook uri),也会发生这种情况
编辑:This site 表示您需要成为 "Organization Management" 组的成员才能 运行 这些 cmdlet。