1

This removes all FullAccess accessrights from a mailbox for a certain user.

Remove-MailboxPermission -identity MyMailbox -user SomeUser -AccessRights FullAccess

This removes SendAs accessrights

Remove-MailboxPermission -identity MyMailbox -user SomeUser -AccessRights SendAs

Is there something I can do to remove ALL accessrights in one go, so I do not have to explicitly have to remove every single kind of accessright?

4

3 回答 3

1

尝试这个:

Remove-MailboxPermission -Identity MyMailbox -User SomeUser -AccessRights FullAccess -InheritanceType All

或(未测试)

$ar = "FullAccess", "SendAs", "ExternalAccount", "DeleteItem", "ReadPermission", "ChangePermission", "ChangeOwner"
Remove-MailboxPermission -Identity MyMailbox -User SomeUser -AccessRights $ar -InheritanceType All
于 2013-08-14T09:02:24.407 回答
0

删除-MailboxPermission -Identity hppo.us@something.com -User vcx@something.com -AccessRights FullAccess -Confirm: $false

删除-RecipientPermission hr-stuttgart@something.com -AccessRights SendAs -Trustee Paul.Rumiz@something.com -confirm: $false

于 2013-08-14T17:35:12.923 回答
0

这是我最终得到的结果:

(假设使用 samaccountname/identity 输入 $alias)

Get-MailboxPermission -Identity $alias | ForEach-Object {Remove-MailboxPermission -identity $_.Identity -user $_.User -AccessRights FullAccess -InheritanceType All -confirm: $false}
Get-MailboxPermission -Identity $alias | ForEach-Object {Remove-MailboxPermission -identity $_.Identity -user $_.User -AccessRights ReadPermission -InheritanceType All -confirm: $false}
$Permissions = Get-Mailbox -identity $alias | where {($_.Identity -like "*")} | Get-ADPermission | Where-Object { ($_.ExtendedRights -like "*send-as*") -and $_.User -notlike "*AUTHORITY*" }
if ($Permissions) 
{
    $Permissions | ForEach-Object{ Remove-ADPermission -identity $_.Identity -user $_.User -ExtendedRights "Send As" -confirm:$false }
} 

$mb = Get-mailbox -Identity $alias
$mb.GrantSendOnBehalfTo = "CN=SomeAdminAccount,CN=Users,DC=ourdomain,DC=local"

Set-Mailbox -Identity $alias -GrantSendOnBehalfTo $mb.GrantSendOnBehalfTo

可以做得更优雅一点,但可以很好地完成工作。

也可以使用远程 powershell,使用管道的“创造性”解决方案通常会失败。

于 2013-10-02T14:29:29.503 回答