Script repository

Send notification to everybody who has Full Access to mailbox

Updated on: Jan 18, 2026, Views: 1616

Exchange

The script sends an email notification to everybody who has Full Access to the target mailbox. To execute the script, create a business rule, custom command or scheduled task configured for the User object type.

Parameters

  • $subject - the email notification subject.
  • $message - the email notification text.
# Email settings
$subject = "My Subject" # TODO: modify me
$message = "My Message" # TODO: modify me

# Get Exchange properties.
$mailboxParams = $Context.TargetObject.GetMailParameters()

# Get Full Access permissions.
$objectReferences = $mailboxParams.MailboxRights.GetTrusteesGrantedRights("ADM_EXCHANGE_MAILBOX_RIGHTS_FULL_ACCESS")

foreach ($objectReference in $objectReferences)
{
    $sid = $objectReference.ObjectSid
    if ([System.String]::IsNullOrEmpty($sid))
    {
        continue
    }
    elseif ([Softerra.Adaxes.Utils.WellKnownSecurityPrincipalInfo]::IsWellKnown($sid))
    {
        continue
    }
    
    try
    {
        # Get object email.
        $object = $Context.BindToObject("Adaxes://<SID=$sid>")
        $to = $object.Get("mail")
    }
    catch
    {
        continue
    }
    
    # Send mail
    $Context.SendMail($to, $subject, $message, $NULL)
}

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    We use cookies to improve your experience.
    By your continued use of this site you accept such use.
    For more details please see our privacy policy and cookies policy.