Script repository
The script grants the target user full access over a specific mailbox. To execute the script, create a business rule, custom command or scheduled task configured for the User object type.
In the script, the $mailboxDN variable specifies the distinguished name (DN) of the object that represents the mailbox to grant full access over. For information on how to get an object DN, see Get the DN of a directory object.
$mailboxDN = "CN=John Smith,OU=Users,DC=Domain,DC=com" # TODO: modify me
# Create an instance of the 'AdmExchangeMailboxParameters' class.
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"
# Specify trustee
$objReference = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$objReference.ObjectDN = "%distinguishedName%"
# Specify permission
$permission = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxPermission"
$permission.AllowedRights = "ADM_EXCHANGE_MAILBOX_RIGHTS_FULL_ACCESS"
$permission.Trustee = $objReference
# Append to existing permissions.
$permissionModification = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxRightsModification"
$permissionModification.Operation = "ADS_PROPERTY_APPEND"
$permissionModification.Permission = $permission
# Update mailbox settings.
$mailboxRights = $mailboxParams.MailboxRights
$mailboxRights.AddModification($permissionModification)
$mailboxParams.MailboxRights = $mailboxRights
# Save the changes
$user = $Context.BindToObjectByDN($mailboxDN)
$user.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")
Comments 2
You must be signed in to comment.
Ali Abbasi
I wonder if there is a way to do the same with cloud-only shared inboxes?
Support
If your Microsoft Entra domain is managed by Adaxes, it should be possible. In Adaxes, Microsoft Entra domain objects have distinguished names. You can get them the same way as described in the following SDK article: https://www.adaxes.com/sdk/HowDoI.GetDnOfObject.