locked
Need help making a script for Office 365 Exchange RRS feed

  • Question

  • Hi Guys,

    I am a novice at PowerShell and I need your expert magician skills.
    I need to run a report on our Exchange accounts that shows all mailboxes that have a forward on them and exclude forwards that are from a certain domain e.g @outlook.com.

    Then if possible just forwards that have been created in the last 30days.

    I currently use this and it just shows me all accounts (Even ones that have no forwards on them) and all forwards:
    "Get-Mailbox -ResultSize Unlimited | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward | export-csv -path C:\365Extracts\FWDS.csv"

    Also do you have any tips on how I could have worked this out myself?

    Thanks so much,

    Dan
    Thursday, March 8, 2018 2:37 AM

All replies

  • Hi Dan,

    According to your description, you can try with this command to get mailboxes which ForwardingSmtpAddress are not empty and not match @outlook.com, for your reference, hope it is helpful to you:
    Get-Mailbox -ResultSize Unlimited |
        Where-Object {$_.ForwardingSmtpAddress -notmatch '^$|@outlook.com'} |
            Select-Object UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward |
                Export-Csv -Path C:\365Extracts\FWDS.csv -NoTypeInformation

    If you need further help, please feel free to let us know.

    Best Regards,
    Albert

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, March 9, 2018 2:44 AM
  • Hi,

    Just checking in to see if the information provided was helpful. Does the script work?

    Please let us know if you would like further assistance.

    Best Regards,
    Albert

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, March 13, 2018 5:45 AM
  • Hi,

    I am checking how the issue is going, if you still have any questions, please feel free to contact us.

    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
    If no, please reply and tell us the current situation in order to provide further help.

    Appreciate for your feedback.

    Best Regards,
    Albert


    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, March 15, 2018 7:45 AM