locked
Searching for Inbox Rules that forward emails to an external source RRS feed

  • Question

  • Hello,

    I have two questions.

    1. Does anyone have a good PowerShell command that will help me in identifying users who have automatic forwarding rules setup on their mailboxes?

    2.  I am working on a PowerShell command to figure out users who are forwarding all of their emails to an external email address. I have come up with the following command below:

    [PS] C:\Windows\system32>Get-MailboxDatabase -Identity 'db-g2' | Get-Mailbox | Get-InboxRule | select name,identity,isva
    lid, @{Name="Forward To";Expression={[string]::join(";",($_.ForwardTo))}} | Export-Csv c:\scripts\DB-G2a.csv

    When executed, I see the following error messages below. Do these error messages mean that their are no Inbox Rules setup on these mailboxes? Thanks for your time in reading this post.

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/CJD\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : D37E4491,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/Emj\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 44E30D0C,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Greensboro/Accounts/BKahn\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : AD24A0D8,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charleston/Accounts/Hwj\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : D0A46ACE,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charlotte/Accounts/RHH\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 38F79226,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/17\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 955BBDF4,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    WARNING: The Inbox rule "after the message arrives" contains errors. To resolve the error, please edit the rule or
    re-create it.
    The operation couldn't be performed because 'lawfirm.local/Greensboro/Accounts/WKing\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : FF7A582E,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charleston/Accounts/Ssj\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 29C0E88F,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Greensboro/Accounts/JCotterill\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 3FD09BEE,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/Loaner1\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : C294D1E8,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Greensboro/Accounts/Heard Case\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 2649A5E8,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charleston/Accounts/DAL\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : CA9FEC72,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Raleigh/Accounts/JRandall\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 8C74A,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Hilton Head/Accounts/MJordan\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 6684019F,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    WARNING: The Inbox rule "P64" contains errors. To resolve the error, please edit the rule or re-create it.
    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/KBrown\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : E118AFAD,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/MBuonforte\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : CA25F8ED,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charlotte/Accounts/TempCHLT\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 429FEE13,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Greensboro/Accounts/CLane\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 3BC31ECF,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/KCollins\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : C4931297,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/MHouck\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 732CE1DB,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Greenville/Accounts/LLedbetter\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 9CA56D5E,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charleston/Accounts/TJohnston\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : F1194F18,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/SHultstrand\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 455BAD26,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/LCarpenter\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 92A55078,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charlotte/Accounts/Courier_CHLT\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 6B6B5681,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Administrative Accounts/Vendors/MBeasley\' couldn't be found
    .
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 524D6EE5,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charleston/Accounts/BSprinkle\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 91B12A0B,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Administrative Accounts/Vendors/eDockets_User1\' couldn't be
     found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 893084E2,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Administrative Accounts/Vendors/RPatterson\' couldn't be fou
    nd.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 100047F7,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Administrative Accounts/Vendors/DSpencer\' couldn't be found
    .
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 501FC2B1,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Administrative Accounts/Vendors/SCarr\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : E660FBCE,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/AMitchell\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 4AB1A423,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/SSvedberg\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : F2935759,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charleston/Accounts/RJones\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : A65836F0,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Columbia/Accounts/PCanders\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 4CB9950A,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule

    The operation couldn't be performed because 'lawfirm.local/Charlotte/Accounts/DLouvier\' couldn't be found.
        + CategoryInfo          : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
        + FullyQualifiedErrorId : 33CF377A,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule


    Jason

    Thursday, October 2, 2014 3:07 PM

Answers

  • I figured out these errors are to be expected. Sorry for the post here.

    http://blogs.msdn.com/b/canberrapfe/archive/2012/11/05/ever-needed-to-find-server-side-outlook-rules-that-forward-mail-outside-of-your-organisation.aspx


    Jason

    Friday, October 3, 2014 5:39 PM

All replies

  • Try changing up your command

    Get-Mailbox -database 'db-g2' | Get-InboxRule | select name,identity,isvalid, @{Name="Forward To";Expression={[string]::join(";",($_.ForwardTo))}} | Export-Csv c:\scripts\DB-G2a.csv




    DJ Grijalva | MCITP: EMA 2007/2010 SPA 2010 | www.persistentcerebro.com

    Thursday, October 2, 2014 7:59 PM
  • DJ,

    I still get the same "the operation couldn't be performed" error messages when executing the PowerShell command. Thanks


    Jason

    Thursday, October 2, 2014 9:12 PM
  • I figured out these errors are to be expected. Sorry for the post here.

    http://blogs.msdn.com/b/canberrapfe/archive/2012/11/05/ever-needed-to-find-server-side-outlook-rules-that-forward-mail-outside-of-your-organisation.aspx


    Jason

    Friday, October 3, 2014 5:39 PM