If I was the administrator only I would say “administrator:\Junk E-Mail”.
Now I’m going to pipe that over to the new inbox rule cmdlet but I’m going to have to loop through each of these mailboxes.
So I’m going to start a loop, and what you’ll see sometimes is that people instead of using the For Each-Object cmdlet, they’ll use this % sign, which is the alias for the For Each-Object which is common.
Help new-inboxrule –Examples As you can see in example 1.
We are just creating an inbox rule in the current mailbox calling it check action required.
Inside the % sign, we’re going to have our script block and here’s where will run our code.
So I’m going to do a new inbox rule and specify a name.Maybe you have to add an inbox rule to every single mailbox so that’s more of a realistic approach.Let’s say that we have ‑‑ and this is more of a common thing ‑‑ sometimes you’ll have an appliance out on your DMZ and then it sends you an email message that it suspects is a SPAM message and the administrator of those appliances will put something like this in the subject line.Next, ff that’s the case, I want to move it to a folder. What I want to do is reference the actual mailbox name with a colon, backslash and then the name of the folder.So what that would look like if I was just doing one user would look something like this.You might want to set up an inbox rule for everybody like in a certain OU that would do that. As an administrator, if I want to do this in every mailbox in the –Organizational Unit Sales for example: I want to pull all these mailboxes and add an inbox rule to these, I’d have to have full mailbox permissions to each one of those.