Archive for February, 2016

Office 365 PowerShell Tip: Bulk change UPN’s

February 26, 2016 2 comments

Sometimes you may provision accounts in Office 365 before any sort of domain validation.  In this case, you don’t want to hit up each user account and manually change the UPN one at a time, possibly leading to setting something incorrectly.  We’re going to give you some PowerShell code you can cut and paste to make this change.  This code will effectively:

  1. Change the domain portion of the UPN to the domain of your choice
  2. Not change the UPN of the admin account (we determine this by ignoring any UPN that begins with “admin@”).  Normally you aren’t going to change the admin account UPN to your own domain and will leave it as the address.

Here’s a quick two line PowerShell command you can do to change all of the UPN’s in your account:

  1. Install the Office 365 PowerShell modules
  2. Launch the command shell from the start menu (Start → All Programs → Microsoft Online Services → Microsoft Online Services Module for Windows PowerShell)
  3. Copy and paste the following into the window (replace with your own domain)


Get-MsolUser -all | Where { -Not $_.UserPrincipalName.ToLower().StartsWith(“admin@”) } | ForEach { Set-MsolUserPrincipalName -ObjectId $_.ObjectId -NewUserPrincipalName ($_.UserPrincipalName.Split(“@”)[0] + “”) }

As you can see, PowerShell is a very powerfull tool to perform bulk operations.



Categories: Office 365

How to bulk assign Office 365 licenses from CSV file

February 24, 2016 Leave a comment


The most frequest gripe I hear from customers regarding Office 365 is license management. Managing licenses manually through the MOP for one or two users is fine. Managing licenses for 15,000 users is a bit more involved. This post deals with bulk license assignment using a CSV input file.

1. Log on to a machine that has ‘Microsoft Online Services Module for Windows PowerShell’ installed. You can install this on your own workstation but it should also be installed on your ADFS Servers.

2. Create a new text file. The example used here is called c:tempuserlist.csv

3. Open c:tempuserlist.csv in Notepad

4. Populate userlist.csv

  • The first row should contain the heading UserPrincipalName
  • All remaining rows should contain a list of Active Directory UPNs for the users that you want to license (one UPN per line). If you’re a multinational tenant with multiple usage locations then don’t add users in different…

View original post 183 more words

Categories: Windows Client