Link to home
Start Free TrialLog in
Avatar of SAM2009
SAM2009Flag for Canada

asked on

Set 365 mailbox rule with PowerShell

Hi,

How can I create this 365 mailbox rule with PS? Example:

Name     : 365 Service Alert
Priority (top of the list of rules) : 1
Body contains words:  Major and Impact

If the message was received from '365Alert@microsoft.com'
Take the following actions:
move the message to folder: Inbox\365Alerts
and stop processing more rules on this message
Avatar of Michael Sheard
Michael Sheard
Flag of United Kingdom of Great Britain and Northern Ireland image

You can use Powershell.
Here’s the cmdlet syntax you need.
https://docs.microsoft.com/en-us/powershell/module/exchange/new-inboxrule?view=exchange-ps
SOLUTION
Avatar of Kev Kelly
Kev Kelly
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SAM2009

ASKER

How can I set the PS if my subfolder  name is in 2 words, like: 365 Alerts
Take the space out of the folder name. :)
...have you tried putting the space in the command?
Avatar of SAM2009

ASKER

OK work with space too. Thanks

One more question. To get my new rule on the top of the list is it with Priority parameter we can do that?
Avatar of SAM2009

ASKER

Sorry I just realize that I need to Priority = 0 instead of 1
Yes, the priority parameter should do that

The Priority parameter specifies a priority for the Inbox rule that determines the order of rule processing. A lower integer value indicates a higher priority
Avatar of SAM2009

ASKER

Also this: -BodyContainsWords "Major","Impact"

Set a rule like body contains: Major or Impact

How can I set for "AND", like body contains: Major AND Impact
How can I set for "AND", like body contains: Major AND Impact

I don't think that is possible.
Avatar of SAM2009

ASKER

Weird no?  I also checked in MS site and there nothing about AND.
Avatar of SAM2009

ASKER

The workaround I found is to add a second condition. Many thanks!