Bulk Updating Office 365 Department for users via PowerShell

This has good applications in a school or college where you have cohorts moving up a year. It also is useful for enterprise where a department has been renamed.

$Mailboxes = get-user -Filter {Department -like "Year 11"}
$Mailboxes | ForEach-Object { set-user -Identity $_.Identity  -Department "Year 12" }

Remember to first delete all your Year 12 (aka. leavers) before running the script otherwise it will become complicated very quickly with merged year 12 from year 11 and year 12 who have left.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Comment on this topic

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s