Setting an inbox rule for a mailbox using PowerShell
May 21, 2009 3 Comments
I was talking to a US East Coast Higher Education institution yesterday that is currently in the process of rolling out Outlook Live. They intend doing a hard switch over of the service behind the existing student email addresses, and one thing they also wanted to retain were redirection rules that the students had set up… they have all of the details for this on a per-address level. This objective can be achieved through PowerShell scripting… what follows are the component commands to use.
In Outlook Live, inbox rules are set on a per-mailbox basis… and this is something that users would normally configure manually through Outlook 2007 or OWA. An administrator can however grant themselves with access to a mailbox, and then proceed to set up rules on the end-user’s behalf. In this example, I am using JennyA as the mailbox to configure, and Admin as the mailbox admin. JennyA is redirecting her mail to her personal Hotmail account.
First of all, as an admin, you need to grant yourself full access rights to the mailbox:
add-MailboxPermission -Identity jennya -User admin -AccessRights fullaccess
Then add the new inbox rule to
new-inboxrule -name "Redirect to personal hotmail" -mailbox jennya -redirectto firstname.lastname@example.org
You will see something like this:
Finally, remove the admin’s access rights
remove-MailboxPermission -Identity jennya -User admin -AccessRights fullaccess
So that is it…enjoy!