# Exchange 2013 – Grant SendOnBehalf permission for Mailbox overwrites Existing permissions

When you change GrantSendOnBehalfTo in Exchange PowerShell, use add and remove operations instead of replacing the whole delegate list by accident.

blog

22 Jan 2016 en

![Exchange 2013 – Grant SendOnBehalf permission for Mailbox overwrites Existing permissions](/wp-content/uploads/2016/02/MicrosoftExchange.png)

Managing **Send on Behalf** in the Exchange UI is straightforward. The trap appears when you switch to **PowerShell** and assume that setting `GrantSendOnBehalfTo` behaves like a safe incremental update.

## The easy mistake

Usually people reach for a direct `Set-Mailbox` update and assume they are only adding one delegate. In reality, assigning a new value directly to `GrantSendOnBehalfTo` can replace the entire existing list.

That is fine when you are setting it for the first time. It becomes a problem when several delegates are already present and you only meant to add or remove one person.

## Safer approach

Use the Exchange hashtable syntax with `@{add=...}` and `@{remove=...}` so you update the property incrementally instead of overwriting it.

```powershell
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}
}
```

## Example usage

```powershell
Add-MailboxGrantSendOnBehalfTo -NewTrustee  -TargetMailbox

Replace-MailboxGrantSendOnBehalfTo -NewTrustee  -OldTrustee  -TargetMailbox

Remove-MailboxGrantSendOnBehalfTo -OldTrustee  -TargetMailbox
```

## Practical advice

Before changing anything, check the current delegate list first:

```powershell
Get-Mailbox <MailboxIdentity> | Select-Object -ExpandProperty GrantSendOnBehalfTo
```

That makes it much easier to confirm whether you are adding a missing delegate, removing an old one, or cleaning up a mailbox that already has multiple entries.

## Current note

Microsoft still documents `GrantSendOnBehalfTo` with add/remove hashtable syntax for recipient management. So the core lesson from this post still applies: if you are editing an existing delegate list, do not overwrite the whole property unless that is exactly what you intend.

## Related Projects

Projects that align with this post's tags, categories, and content.

[All projects](/projects/)

Matching projects...

[Back to Blog](/blog)

## Related posts

- [Microsoft Exchange – Set address book policy based on group membership](/blog/microsoft-exchange-set-address-book-policy-based-group-membership/)
- [Exchange 2013 – How to add Relay Connector from PowerShell](/blog/exchange-2013-how-to-add-relay-connector-from-powershell/)
- [Creating Visual Indicators for spoofed / external emails with PowerShell](/blog/creating-visual-indicators-for-spoofed-external-emails-with-powershell/)

<!-- PowerForge markdown artifact sha256:4DE03D39ED78AC6B88F34C67DC6ACF1F86738C4574151A69FB7C7C832BA1CF80 -->
