We help IT Professionals succeed at work.

query all mailbox rules

2,827 Views
Last Modified: 2017-04-19
I want to search all users on my tenant and then search any one has a forwarding rule that is sending/forwarding emails to a particular user

Eg:
if that is for a single mail box:
Get-InboxRule -Mailbox sales@mycompany.com -> this will list all rules for a particular mail box.
 Get-InboxRule -Mailbox sales@mycompany.com -Identity "rule1" | select -ExpandProperty Description -> this would give me the description..

if this is for a single mail box, I can work manually,

problem/need some direction for:
but I need to search all mail boxes and then find any rules on that mail box with a description "forward the message to"

not sure how do I accomplish this..  - can some one give me some direction..
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2019

Commented:
The example I posted above does just that. Maybe try running it?

Author

Commented:
sure if that works, it would be a good one for me.
but, I am a bit confused of % and ? mark symbols  on the above script..
I will test @ my end -- thx a bunch..
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2019

Commented:
% is a short-hand notation (or alias) for Foreach-Object.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.