blog
Exchange 2013 – GrantSendOnBehalfTo nadpisuje wcześniejsze uprawnienia SendOnBehalf dla skrzynki pocztowej
Zmiana ustawienia **Send On Behalf **w Exchange 2010 / Exchange 2013 lub Exchange 2016 jest czynnością, którą można wykonać w prosty sposób z ECP lub ECM. Niestety przy próbie zmian uprawnień **Send On Behalf **z poziomu **PowerShell **czynność ta staje się trochę bardziej ryzykowna.Większość osób przy pierwszej możliwej sposobności użyje komendy
Set-Mailbox -GrantSendOnBehalf
W założeniu prosta komenda powershellowa ma niestety jedną wadę. Nadpisuje pole które ustawia, w tym przypadku nadpisując ustawienia GrantSendOnBehalf. O ile w pierwszej chwili nie jest to problem, bo zazwyczaj pole to jest puste. O tyle przy większych środowiskach Exchange, gdzie takie uprawnienia są już nadane wcześniej może to powodować duże problemy przy próbie zmiany pola **GrantSendOnBehalf, **a nadpisanie go najcześciej skutkuje usnięciem dużej grupy osób.Na szczęście jest prosta metoda by nie nadpisywać tych ustawień. Poniżej możecie znaleźć kilka komend, które potrafią ułatwić życie administratora Exchange.
function Add-DistributionListGrantSendOnBehalfTo { Param($newTrustee, $targetDistributionGroup)
Set-DistributionGroup $targetDistributionGroup -GrantSendOnBehalfTo @{add=$newTrustee}
}
function Remove-DistributionListGrantSendOnBehalfTo { Param($oldTrustee, $targetDistributionGroup)
Set-DistributionGroup $targetDistributionGroup -GrantSendOnBehalfTo @{remove=$oldTrustee}
}
function Replace-DistributionListGrantSendOnBehalfTo { Param($oldTrustee, $newTrustee, $targetDistributionGroup)
Set-DistributionGroup $targetDistributionGroup -GrantSendOnBehalfTo @{add=$newTrustee}
Set-DistributionGroup $targetDistributionGroup -GrantSendOnBehalfTo @{remove=$oldTrustee}
}
function Remove-MailboxGrantSendOnBehalfTo { Param($oldTrustee, $targetMailbox)
Set-Mailbox $targetMailbox -GrantSendOnBehalfTo @{remove=$oldTrustee}
}
function Add-MailboxGrantSendOnBehalfTo { Param($newTrustee, $targetMailbox)
Set-Mailbox $targetMailbox -GrantSendOnBehalfTo @{add=$newTrustee}
}
function Replace-MailboxGrantSendOnBehalfTo { Param($oldTrustee, $newTrustee, $targetMailbox)
Set-Mailbox $targetMailbox -GrantSendOnBehalfTo @{remove=$oldTrustee}
Set-Mailbox $targetMailbox -GrantSendOnBehalfTo @{add=$newTrustee}
}
Podstawowe użycie komend Exchange PowerShell opisanych powyżej:
Add-MailboxGrantSendOnBehalfTo -NewTrustee -TargetMailbox
Replace-MailboxGrantSendOnBehalfTo -NewTrustee -OldTrustee -TargetMailbox
Remove-MailboxGrantSendOnBehalfTo -OldTrustee -TargetMailbox