Retrieve all Inbox Rules from my tenant (Office365)
Hi everybody,
Is there any way to get all Inbox Rules from my users in my tenant?
For example, I try to run the cmdlet "Get-Mailbox
user@domain.com | Get-InboxRule" but it fails with the below error message:
+ CategoryInfo : NotSpecified: (:) [Get-InboxRule], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : [Server=BL2PR04MB036,RequestId=b26f89c7-f38a-4265-822d-9f8b9da48e98,TimeStamp=17/09/2013
02:04:05 p.m.] D4CD8C92,Microsoft.Exchange.Management.RecipientTasks.GetInboxRule
+ PSComputerName : pod51041psh.outlook.com
But if I use the cmdlet "Get-InboxRule -Mailbox
user@domain.com" I got the expected result.
Thanks in advance,
September 17th, 2013 1:28pm
Hi,
This is happening because piping Get-Mailbox to Get-InboxRule isn't sending the right input object. Get-InboxRule expects input of type InboxRuleIdParameter, not Microsoft.Exchange.Data.Directory.Management.Mailbox.
See this for more information:
http://technet.microsoft.com/en-us/library/dd351062%28v=exchg.141%29.aspx
Any reason you can't just use -Mailbox parameter on Get-InboxRule?
September 17th, 2013 1:36pm
Get-Mailbox "name" | Foreach-Object {Get-Inboxrule $_}
Maybe something like this will do? ( I can't test it out now unfortunately)
September 17th, 2013 2:07pm
I may have to backpedal a bit on my previous post. I don't have O365, but I do have Exchange 2010 (same idea). Get-Mailbox username | Get-InboxRule worked just fine for me.
September 17th, 2013 2:13pm
Hi Mike,
Thanks for your quick response. Im not using the -Mailbox parameter because I need the Get-InboxRule for all the users hosted on my tenant.
Regards,
September 17th, 2013 4:35pm
Hi Thom,
I try it on PS and got the below error message:
PS C:\Windows\system32> Get-Mailbox "User A" | Foreach-Object {Get-Inboxrule $_}
Cannot process argument transformation on parameter 'Identity'. Cannot convert value "Martin de los Santos" to type
"Microsoft.Exchange.Configuration.Tasks.InboxRuleIdParameter". Error: "Cannot convert hashtable to an object of the
following type: Microsoft.Exchange.Configuration.Tasks.InboxRuleIdParameter. Hashtable-to-Object conversion is not
supported in restricted language mode or a Data section."
+ CategoryInfo : InvalidData: (:) [Get-InboxRule], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-InboxRule
+ PSComputerName : pod51041psh.outlook.com
Any suggestion?
September 17th, 2013 4:36pm
Get-Mailbox | % { Get-InboxRule $_ } returns good data for me, but the output will need to be adjusted (which mailbox the rules are applied to is not shown). Does this work for you?
September 17th, 2013 4:50pm
Hi Mike,
Same error message:
Cannot process argument transformation on parameter 'Identity'. Cannot convert value "User A" to type
"Microsoft.Exchange.Configuration.Tasks.InboxRuleIdParameter". Error: "Cannot convert hashtable to an object of the
following type: Microsoft.Exchange.Configuration.Tasks.InboxRuleIdParameter. Hashtable-to-Object conversion is not
supported in restricted language mode or a Data section."
+ CategoryInfo : InvalidData: (:) [Get-InboxRule], ParameterBindin...mationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-InboxRule
+ PSComputerName : pod51041psh.outlook.com
September 17th, 2013 5:37pm
Hmm, Office 365 apparently works differently than Exchange 2010. Take a look at the suggestion in this thread, apparently it helped this other person looking to do the same thing you are:
http://community.office365.com/en-us/forums/148/t/77289.aspx
You may also want to post a question over there if this doesn't work for you, since this issue seems to be Office 365 specific.
September 17th, 2013 8:26pm
Hi Mike,
I found an answer in the other thread :) The cmdlet is:
$mbox = Get-Mailbox; $mbox | Foreach { Get-InboxRule -Mailbox $_.DistinguishedName }
Have a nice day!
- Marked as answer by
Lucas Martin Pohl
14 hours 44 minutes ago
September 18th, 2013 3:32pm
Cheers, I'm very glad it worked out.
September 18th, 2013 3:44pm
Hi Mike,
I found an answer in the other thread :) The cmdlet is:
$mbox = Get-Mailbox; $mbox | Foreach { Get-InboxRule -Mailbox $_.DistinguishedName }
Have a nice day!
- Marked as answer by
Lucas Martin Pohl
Wednesday, September 18, 2013 7:46 PM
September 18th, 2013 10:31pm