Assign licenses to O365 users programmatically

powershell

Just recently we migrated from our own mail server to Office365, because cloud is computing is the god damn future! 1tb of onedrive space and 50gb mailbox is more than enough to host your work-related porn collection :)
Azure is all set up to synchronize our AD users with Office365, however once a user is created newly into the AD, the mailbox gets created for that user, but it doesn’t set the license and location of the user, until the license is assigned, users can’t login to the mailbox. I hate repetitive work, so I came up with a powershell script (I love powershell!) that checks for users that doesn’t have license assigned and assigns them one, also adds the location.
The script at the end also disables the new “clutter” feature, which is complete garbage IMO. Most of the legitimate letters go into clutter and users complain to us that letters do not reach them. Microsoft declares that this new super-awesome feature helps people save up to 82 minutes checking their mail… I guess that’s correct when you don’t see any emails :D

The script can be found here.

Leave a Reply

Your email address will not be published. Required fields are marked *