Exchange Server Share

May 26, 2008

FAQ: Find all users with Forwarding Address is set

Filed under: Exchange,Exchange 2003,Exchange 2007,PowerShell — Amit Tank @ 11:50 am

This is most commonly asked question, how to get list of user with forwarding address is set.

Exchange 2003:

In native Exchange 2003 you can do a custom search in Active Directory Users & Computers to find all users with forwarding address is set with some internal or external address.

(objectClass=*)(altrecipient=*)

Example: I have set a forwarding address for User 32 to forward all mails to User 31.

image

Now find it with Custom Search.

Active Directory Users & Computers -> Find -> Select Custom Search -> Enter (objectClass=*)(altrecipient=*) in LDAP Query Text Box -> Click Find Now.

image

Exchange 2007:

If Exchange 2007 is in native mode or co-existence with Exchange 2003 then you can use PowerShell to find the same thing.

Get-Mailbox | Where {$_.ForwardingAddress -ne $null} | Select Name, ForwardingAddress, DeliverToMailboxAndForward

Example: I have set a forwarding address for User 22 to forward all mails to User 21.

image

Now find it with PowerShell.

image

Note: PowerShell gives all users who are on Exchange 2007 as well as Exchange 2003. You can see the Exchange Version in below screen.

image

Hope this helps you guys!!! Put your comments…!!!

 

About these ads

6 Comments

  1. Excellent

    Comment by prabhu — June 7, 2008 @ 8:58 pm

  2. [...] Please refer my previous post FAQ: Find all users with Forwarding Address is set [...]

    Pingback by Find Exceptional Mailboxes in the Exchange Environment « Exchange Server Share — June 11, 2008 @ 4:02 pm

  3. Hi,

    Is there a script to set the selected users mail forwarding address back to none?

    Thanks

    Calvin

    Comment by Calvin — June 11, 2008 @ 5:21 pm

  4. Hi Calvin,

    Make sure that you run this on Exchange 2007 users only, if you add Exchange 2003 users to manage with Powershell (EMS) then you need to manage it with Powershell(EMS)/EMC everytime.

    Copy all users to users.txt file for whom you need to set forwarding address none -> Copy below code to RemFor.ps1 file -> Open EMS -> go to the path where these users.txt & RemFor.ps1 is available -> run this command ./RemFor.ps1

    ======================================
    $Users = get-content “users.txt”

    foreach ($user in $users)
    {
    Set-Mailbox $user -ForwardingAddress $null
    Set-Mailbox $user -DeliverToMailboxAndForward $false
    Get-Mailbox $user | Select Name, ForwardingAddress, DeliverToMailboxAndForward
    }
    ======================================

    Comment by Amit Tank — June 12, 2008 @ 4:09 am

  5. I believe in giving credit where it is due. This command works so I wanted to help the questioner on the MS forum, but I wasn’t about to take credit for your work. Thanks for the postings for those of us who need help

    Comment by Terrance Brennan — September 30, 2008 @ 4:06 pm

  6. I just read your last comment on how to remove the forwardingaddress from a user. Thanks, I have been looking for this all morning. You have no idea how much work you just saved me and my co-workers.

    Comment by Terrance Brennan — September 30, 2008 @ 4:12 pm


RSS feed for comments on this post.

The Rubric Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 29 other followers

%d bloggers like this: