Thanks for your reply !
I'm a noob of using adaxes and feel a little confused about those commands. Your reply is really helpful.
I'm going to talk more about my case.
I created a custom command, actions:
a. If the User is located under the 'testOU' container AND
b. If account is inactive for more than 26 weeks AND
c. If the User has an Exchange mailbox then (here , i can get %distinguishname% or %fullname% something else)
d. Run PowerShell script 'get forwarding address' for the User (i can use the script that you provided, thanks)
e. Send e-mail notification to "$forwardTo"
Part d,
I think I can use(but I don't know how can I get the value from part a/b/c and put it into part d, and eventually get the value $forwardTo ) :
# Get mailbox parameters
$mailboxParams = $Context.TargetObject.GetMailParameters()
# The $mailboxParams variable contains properties of the user mailbox on which the script is run
# Get Delivery Options
$deliveryOptions = $mailboxParams.MailFlowSettings.DeliveryOptions
# Forward to
$forwardTo = $deliveryOptions.ForwardingAddress
Thank you so much !