Office 365 – User Licensing basics using PowerShell

I’ve been doing quite a bit of work around Office 365 lately, and have been getting a number of question’s around licensing of users.

In this post ill cover the most basic commands needed for managing users. Sometime i’ll hopefully find the time to write a post covering some of the more detailed options available when managing licenses.

Salamander Active Directory
Firstly, I should say that Salamander Active Directory can now handle the Licensing needs for most schools.

It can be used to manage the licenses for existing users as well as new starters and leavers.

Connecting to Office 365
The first step is to connect to Office 365. If your not familar with this, have a look at this post:

List all the License Plans
Licenses are packaged into plans. When you are working in Office 365 online, you’ll see the ‘display’ name for these, but when working in Powershell you need to know their ‘real’ name, or AccountSKU.

You can very quickly get a list of the AccountSKU’s in your Tenancy using:

#Basic command

#More detailed information
Get-MsolAccountSku | Format-Table AccountSkuId, SkuPartNumber, ActiveUnits, ConsumedUnits

Service Plans
Once you’ve established the names of the Plans, it is often useful to look at the service plans inside those. Often it may be that a user doesn’t need to have all the available service plans when configuring licenses.

In my Office 365 setup, i have a number of License plans, including:


In the Office 365 Admin Centre this shows as:


In Powershell, you can get a list of these service plans using:

$ServicePlans = Get-MsolAccountSku | Where {$_.AccountSkuId -eq "SalamanderSoft:ENTERPRISEPACK"}

This will list the available service plans in the Pack selected.

In my tenancy these are:


Seeing the licenses for a single user
Sometimes its useful to view the license status for an exsiting user. This is easily done using the following:

$user = ""
(Get-MSOLUser –UserPrincipalName $user).Licenses[0].ServiceStatus


Add a License for a single user
Adding a license with a full pack is very straight forward and can be done with a single command.

Here i am using the variable $user to define the user in question.
You could just add the Full UPN of the user instead.


$user = ""
Set-MsolUserLicense -UserPrincipalName $user -AddLicenses SalamanderSoft:ENTERPRISEPACK 

Adding a License using License Options
Where a user doesn’t need to get the full pack, you can add specific set of plans, by using Licence Options.

In this example, i have used the license options parameter to add the license, with some of the options disabled.

#Set License Options (to disable various plans)
$MyLicenseOptions = New-MsolLicenseOptions -AccountSkuId SalamanderSoft:ENTERPRISEPACK -DisabledPlans OFFICESUBSCRIPTION, RMS_S_ENTERPRISE,MCOSTANDARD

#Set Licenses using the options above
Set-MsolUserLicense -UserPrincipalName $user -AddLicenses SalamanderSoft:ENTERPRISEPACK -LicenseOptions $MyLicenseOptions

This will result in the Office 365 Admin page looking like this:


Removing a License for a single user
We can also remove the license for a single user with a single command.

Set-MsolUserLicense -UserPrincipalName $user -RemoveLicenses SalamanderSoft:ENTERPRISEPACK

Salamander Active Directory – Feature focus – Working with Office 365

As we are seeing more and more schools moving towards Office 365, I thought I’d share what Salamander Active Directory can do for you.

Getting users into Office 365
Salamander AD has always been able to provision your users and groups into your local Active Directory and this doesn’t change with a school using Office 365.

We recommend that you use DirSync to push your users in to Office 365, but we can manage them once they are there.

By Leveraging the Office 365 PowerShell command-lets Salamander Active Directory can license your users based around their status in your MIS.

Obviously, it can assign different licenses to students and staff, but it could also assign different licenses or service plans to 6th Form, or to Teaching Staff etc.

Location and other settings
The capabilities of Salamander isnt restricted to Licensing. We regularly set the location for users, and set mailbox settings on mass. If you need something doing to a lot of users in Office 365, Salamander Active Directory can probably do it for you.

For customers using Sims, Faciltiy CMIS or iSAMS we can also push your Pupils and Staff timetables into Office 365 mailboxes as we can in a local Exchange environment.

Have a look at my post on Exchange Calendar with Salamander

Already a customer?
As with all the Features for Salamander Active Directory, these are available to any Salamander Active Directory, new or existing.

SalamanderSoft and Office 365
As Authorised Education Resellers for Office 365, we can offer you advice and support whether your looking to move to Office 365 or are already there.

Drop me an email for more information, or just to have a chat:

Office 365 – Changing a Username

Recently, i’ve been doing quite a bit of work with clients who have needed to change their usernames in Office 365 for one reason or another and have having difficulty.

In some cases they have managed to update it through the portal, but more often than not, its not quite worked properly and they have needed to change the User Principal Name manually using Powershell.

The good news is that its really straightforward to do. Infact, it’ll probably take you longer to get connected to Office 365 than it will to change the User Principal Name for a user.

Changing a single users User Principal Name
Once your connected (see my blog post on connecting to Office 365) you can simply run the powershell:

#Changing the UserPrincipalName for a single user
Set-MsolUserPrincipalName -UserPrincipalName "" -NewUserPrincipalName ""

This will do simply that, load the object for the user and change their Upn.

If you wanted to do that with variables to make things a little tidier you can:

#Chaning the UserPrincipalName for a single user - using variables
$oldUPN = ""
$newUPN = ""
Set-MsolUserPrincipalName -UserPrincipalName $oldUPN -NewUserPrincipalName $newUPN

Changing more than one
This works really nicely, but last week I had a customer who wanted to change around 30 for various reasons, so I had them make a CSV file to hold the details in 2 columns:


Once they’d generated this file, I simply used the below to change the User Principal Name for everyone in the CSV.

#Using a CSV File to change the UPN's
$path = "c:\pathtomycsv\upnChanges.csv"
Import-csv -path $path | 
foreach-object `
  Set-MsolUserPrincipalName -UserPrincipalName $_.oldUPN -NewUserPrincipalName $_.newUPN


Access Web Apps in Sharepoint Online – An overview

One of the many features of SharePoint Online is the ability to have Access Web Apps in your SharePoint sites, allowing you host some of your data in the cloud.

Previously this has been a complex task, using requiring a specific set of skills, but not with Access Web Apps.

Creating a new Access Web App
The first thing that should be said is that you still need Access 2013 installed on your computer. More to the point, someone will. The Access Web App you build has to be built using Access 2013, but once its built it can be used by anyone with access to the SharePoint site, regardless of the device they are on.

Creating your first web app is straightforward. From your SharePoint Site, you can go to the ‘cog’ and select ‘Add an app’


Once you’re here, on the of options you’ll get is the Access App. Clicking this will simply ask you for a name. You can also upload an access app you made somewhere else.


Once that’s done and you try use it, you’ll get presented with a holding page asking you to open the app in Access to start building. Once you’ve opened your app in access, you’ll see a familiar interface, similar to any other new Access 2013 database.

Building your database
I’m not going talk much about creating databases and managing access databases in this post. Instead, I’ve just created a tiny 2 table database as a sample to have a play with.

I’ve been using Access for year (since Access 2003), and have worked with some very large, complex databases, so I didn’t find this difficult. But, I don’t think anyone will.

It is really quite easy to build a basic Access Web App using Access 2013. Some of the more advanced features will take some work, but there is plenty of support and documentation available for those looking to take it further.

There are also loads of templates to get you going or, as I’ve done you can start with a completely blank database and built it yourself.

As with any other Access Database, you can also import data from another Database, spreadsheet or other source.


Using your Database
Once you’ve got your database built and you launch the app, you’ll be able to use your forms just like any other web app, and very quickly be able to add the data.

Each table automatically gets a list view and datasheet view which will be available in the web app.



Not everyone needs Access
One of the major advantages here is that you can anyone with access to the SharePoint App will be able to use the database. You need Access installed in order to design the database, but the app can be used by anyone, reducing the licensing requirements along with the need to train other users on

Where is my data?
When working with an Access Web App, the data is stored in an Azure SQL Database for your app, and there are a number of ways you can access this data, which I have covered here: Accessing your Access Web App’s Data

They won’t be for everyone, but Access Web Apps are an easy, quick way to start getting data into the cloud. I’d definitely recommend that you investigate it further before making any decisions. It may just be the thing you need.

Features available in access web apps
For some more information on the differences between and Access App and an Access Database have a look at this post:

Yammer? What’s it all about?

Since Yammer was added to our office 365 package, we’ve been using it internally at work and I’ve been thinking about how our customers might be able to utilise it in the future.

What is it?
Yammer is being billed as the ‘Enterprise Social Network’. It’s use has a familiar feel, and students and staff alike will have no difficulty in picking it up. Much like Facebook, there is a newsfeed, but this is much more than that. Yammer is also great for sharing files between co-workers, and having discussions in groups.

So, how much will it cost me?
The good news here is that if you are an Education institution using Office 365, the answer will be nothing.

From April 1st 2014, Microsoft are adding Yammer Enterprise to all of the Office 365 Education plans (A2,A3 and A4)

How might we use it?
Initially, you might think that this is just a gimmick, another toy for people to use with very little useful points. I know I did.

However, after spending some time using it, and thinking about it, I’m confident that there will be a future for Yammer in Education.

In a similar way to Facebook, Yammer supports groups, which allows people to communicate and collaborate on specific topics, or even class by class.

Imagine if each class had a Yammer group where they could share ideas and chat about work, from anywhere.

If your using SharePoint, you can also embed the feed from a group in the class site, and collaborate directly through that, in effect adding to your SharePoint environment.

There are also plans to integrate Office Web Apps with Yammer too, so your staff and pupils could collaborate directly on documents directly from the document itself.

Use it from anywhere
As yammer is part of Office 365, there are many apps available for almost every device and platform, allowing users to collaborate from wherever they are, using whatever they already have. No extra hardware required.

In short, there is a lot more to Yammer than meets the eye, and its well worth investigating what it can do for you.

OneNote is now Free… Everywhere!!

One piece of news that I picked up on last week is that Microsoft was going to make OneNote free for all, from every device. Well, this morning, that became a reality, alongside OneNote for Mac.

OneNote had been available on iOS, Windows Phone and Android for a while now, but this is the first time its been available for Mac OSX, and about time too.

This has probably been the most underrated Microsoft Office product for some time, and like many I was sceptical about its use a couple of years ago. Now though, I can’t live without it.

OneNote Cloud API
Alongside the release of the free version, comes the news that the OneNote service now includes a new Cloud API, which will allow the development of more and more apps to work with OneNote and make this product even better.

Theres already a whole bunch of apps for OneNote, and I’m sure this list with expand greatly over the coming weeks as developers get hold of it.

Do more with OneNote today

For more information:

MS Office Blog – OneNote now on Mac, free everywhere and service powered
MS Office Blog – Introducing OneNote for Mac
WinSuperSite – Introducing OneNote for Mac

Connecting to Office 365 Using PowerShell

More and more the focus is on Office 365, and a lot of the niftier management can/should be done with PowerShell.

Recently, i have been working more and more with Office 365, and connecting to it can be a bit of a pain.

Here, I will demonstrate a couple of ways that you can connect to Office 365 easily, as something you will be doing more and more.

I will also demonstrate a way that you can save the password securely in a separate file, so you don’t have to keep entering it, or have it available in plain text.

Connecting to Office 365 – Prerequisites
Firstly, in order to connect to Office 365 you must have the Windows Azure AD Module for PowerShell installed.

You can find this here:

Connecting to Office 365
A quick Google will give you then commands you need to connect to Office 365 from your new Shell, but i tend to use this set of commands.

#Connect to Office 365, Prompting for Credentials
Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session
Connect-MsolService –Credential $O365Cred

In its most basic form, this will Import the MSOnline powershell module (the one you have just installed) and connect to the Office 365 Service, prompting for your username and password.

This works well, but if you use it often, it can be a pain to keep giving your credentials.

Saving the Password Securely
You can simply add the password to the script, but this will be in plain text, which is not ideal.

To save the password in a more secure fashion, I use the PowerShell script below:

#Set location of TXT file to store the password
$secureFilePath = "D:\365SecureString.txt"

#Enter the password when prompted
#It will be stored in a secure string
Read-Host -Prompt "Enter password to be encrypted in secure string text file" -AsSecureString |
ConvertFrom-SecureString |
#Location of the file to secure the string inside
Out-File $secureFilePath

This will prompt you for a password and save it in a more secure fashion to the file you specify at the top.

Once this file is saved, it can be accessed by any other PowerShell script, simply by reading the file

$pass = GetContent $secureFilePath | ConvertTo-SecureString

Want more on Passwords?
Check out Todd Klindt’s post on using Passwords with PowerShell HERE

Disclaimer on Secure Passwords
Unfortunately, I have to say that there are a couple of ways that this password can be read later on, but only by someone who has the knowledge and access to your file. It will certainly stop someone stumbling upon it.

Putting it together
Now that i have my password stored, you can add this location to the script to connect, and with a couple of tweaks have as script that will connect to Office 365 without any prompting.

Here, I’ve added it as a function. This was, i could save this into my PowerShell Profile so i could access it easily every time I needed it.

Function Connect365 {
    #Location of Password in TXT file
    $secureFilePath = "D:\365SecureString.txt"
    $userName = ""
    $pass = Get-Content $secureFilePath | ConvertTo-SecureString                                                           
    $O365Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $userName,$pass     

    #Function to connect to MSOL using the secure string
    Import-Module MSOnline

    #$O365Cred = Get-Credential
    $O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $O365Cred -Authentication Basic -AllowRedirection
    Import-PSSession $O365Session
    Connect-MsolService –Credential $O365Cred


I’ll cover the use of functions a little more in another blog.