Hi,

I am looking to build a report whereby all users within a specific OU (Disabled and forwarding). The report will return users who have been inactive for 90 days along with the forwarding address. I'm guessing the easiest way to do this is to assign the forwarding SMTP address in Exchange Online to an adaxes custom attribute. I have seen reference to this being possible in answers to other questions but no instructions as to how to do this. Could someone give me the script to be able to do this please?

Thanks!

by (210 points)
by (309k points)
0

Hello Gareth,

Sorry for the confusion, but we are not sure what exactly you need to achieve. What columns should be present in the report? Do you have a hybrid environment?

Any additional information will be much appreciated.

by (210 points)
0

Thanks for the really quick response. So yes, we run a hybrid environment and all forwarding is set through Exchange Online rather than on prem. Is there a way I can run a scheduled task to grab the SMTP forwarding address in Exchange Online and assign it to say, adm-customattributetext1?

by (309k points)
0

Hello Gareth,

So yes, we run a hybrid environment and all forwarding is set through Exchange Online rather than on prem.

What exactly do you mean? Do users have the Forward To (LDAP name altRecipient) property populated in on-premises AD?

Is there a way I can run a scheduled task to grab the SMTP forwarding address in Exchange Online and assign it to say, adm-customattributetext1?

Yes, it is possible. We will provide you with a solution having the answer to the above question.

by (210 points)
0

Sorry for the confusion. We do not have the altRecipient property populated. Nor do we have the MsExchGenericForwarding attribute populated.

1 Answer

by (309k points)
+1 vote

Hello Gareth,

Thank you for the clarification. For information on how to obtain the required data, have a look at the following script sample: https://www.adaxes.com/sdk/SampleScripts.RetrievingMailboxProperties.MailFlow. You can then save the value to an Adaxes custom text attribute (e.g. CustomAttributeText1) and add the corresponding column to the report.

by (210 points)
0

Thanks for the information, so to add it to the attribute am I right in assuming the script would be this?

$deliveryOptions = $mailboxParams.MailFlowSettings.DeliveryOptions

$forwardTo = $deliveryOptions.ForwardingAddress.DisplayName

if ($forwardTo -ne $null) { adm-customattributetext1 = $forwardTo }

by (309k points)
0

Hello,

No, your script will not work. Here is the correct one:

$customAttributeName = "adm-CustomAttributeText1" # TODO: modify me
$pipelined = $True

# Bind to the target user
$user = $Context.BindToObjectByDNEx("%distinguishedName%", $pipelined)

# Get forward to
$mailboxParams = $user.GetMailParameters()
$deliveryOptions = $mailboxParams.MailFlowSettings.DeliveryOptions
$forwardTo = $deliveryOptions.ForwardingAddress.DisplayName

# Update custom attribute
$user.Put($customAttributeName, $forwardTo)
$user.SetInfo()

In the script:

  • $customAttributeName – Specifies the LDAP name of the property to be updated with the data from the Forward To option.
  • $pipelined – Specifies whether to pass the user update through the Adaxes pipeline to trigger business rules, create log records, etc.

Related questions

Im trying to rename "Extension attribute 1 and 2" to something legible for users. Is there a way to cahnge the dsiaply name myslef like how other attributes are done?

asked Feb 17, 2023 by raul.ramirez (210 points)
0 votes
1 answer

Is it possible to add Exchange custom attributes to users self-service portal and allow users to edit/modify them? Background, we're looking at setting up Office ... service account to perform the updates. We would prefer not changing permissions if possible.

asked Sep 15, 2022 by Subz (20 points)
0 votes
1 answer

No edit button is available within Adaxes for these accounts. The service account has 'Mail Recipients' and 'MailRecipientCreation' permissions assigned. What additional configuration or permissions might be needed?

asked May 29 by HappyOtter6153 (20 points)
0 votes
1 answer

We are using Adaxes Directory Object Picker for selecting Distribution Group members. We create external recipients as Exchange Online MailContacts (via New-MailContact). These contacts: are ... Context: We are using cloud-only contacts (no on-prem AD sync).

asked May 27 by IwistIT (140 points)
0 votes
1 answer

Hi, when I enable a license for Exchange Online for a user I get the following warning: Here are the current settings for creating a remote ... : InvalidOperation: (:) [], RuntimeException     + FullyQualifiedErrorId : PropertyAssignmentException

asked Nov 18, 2025 by Allister (90 points)
0 votes
1 answer