Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Complex script for creating inbox rules

$
0
0

I am looking to create an inbox rule for all users in my environment. 

 

I am looking at users created in the last x days, and also verifying if the rule already exists. 

 

This is what I have so far, but there is no logic that checks if the rule exists. 


Appreciate the help!

 

Get-User -resultsize unlimited | where {$_.WhenCreated -gt (get-date).adddays(-7)} | foreach {new-inboxrule -Name Marketing -Mailbox $mbx.alias -SubjectContainsWords "[MARKETING]" -movetofolder ":\Junk E-Mail" -ExceptIfSubjectContainsWords ("RE: [MARKETING]","FWD: [MARKETING]") -StopProcessingRules $true -confirm:$false -Force}


Viewing all articles
Browse latest Browse all 8583