admin nightmare ... mailbox forwards to contact that forwards externally RRS feed

  • Question

  • I am trying to figure out the following information for a stack of users alias, DisplayName, ForwardingAddress | ft -autosize

    then I need to add the windowsEmailAddress from the contact being forwarded to - essentially the output of forwardingAddress of this table.

    I have the following there is a LOT of users, and a few errors so I am trying to select a subset based on a loose match on the forwarding address:

    Get-mailbox -resultsize unlimited -ea silentlyContinue -WarningAction silentlyContinue | select alias,DisplayName,ForwardingAddress | where {$_.ForwardingAddress -like '*somematch*'} | ft -autosize

    also I can get the smtp address off the contact by using:

     get-contact <put in the path displayed as forwardingAddress from above> | select windowsemailaddress | ft -autosize

    But I can NOT seem to do both of these as I am a numpty at all scripting inc powershell.

    Please help?

    Monday, October 12, 2015 4:45 AM


  • I think you're saying:

    • You want to get all mailboxes that have a "Forwarding Address" set to another recipient in your directory.
    • For each of those, show the value of the contact's external smtp address.
    $InScopeMailboxes = Get-Mailbox -ResultSize Unlimited -IgnoreDefaultScope -Filter {ForwardingAddress -like '*'} 
    $InScopeMailboxes | select userprincipalname, alias, DisplayName, ForwardingAddress, @{n="AssociatedContactsExternalSMTP";e={(Get-Recipient $_.ForwardingAddress).PrimarySMTPAddress}} | Out-GridView

    I added UPN for you, since none of the other attributes you chose are guaranteed to be unique.

    Mike Crowley | MVP
    My Blog -- Baseline Technologies

    Friday, October 16, 2015 12:31 AM