0 votes

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 (180 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.

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?

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.

0

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

1 Answer

+1 vote
by (272k points)

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.

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 }

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

0 votes
1 answer

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

Hello, currently we have an Exchange 2019 Server in Hybrid configuration with Exchange Online. During our user onboarding a mailbox for the user is being created by a ... Remote-Mailboxes in this scenario for newly created AD-Users? Thanks and KR Christian

asked Apr 18 by User0815 (40 points)
0 votes
1 answer

Hello, we are in a migration phase from Exchange onPrem to Exchange Online. Since not all of our sites will be migrated at one time we are looking into a way to migrate ... an alerting / sending out a mail if the batch is not succesful? Thanks and KR Christian

asked Mar 21 by User0815 (40 points)
0 votes
1 answer

Hi, is it possible to export automatically the exchange online mailbox of a user to a .PST file on our archive server before the user is deleted? Kind regards, Fabian

asked Oct 26, 2023 by fabian.p (150 points)
3,350 questions
3,051 answers
7,791 comments
545,069 users