Transfer OneNote Class Notebooks


As I’ve said every time I blog about the OneNote Class Notebook, this ever growing in popularity tool is a great addition to any classroom whether you have a 1:1 ratio of devices or not.

I’ve spent a lot of time looking at the product as Microsoft push hard with the marketing effects of the pen and OneNote, I want to make sure that when I work with customers I can be making recommendations about the product as well as how to implement it.  This is one of the reason why I wrote an implementation guide before the OneNote Class Notebook appeared in the App Launcher.

App Launcher

The app launcher version has made it easier to create the Notebooks but does have one downside which is that it stores the OneNote in the teacher OneDrive.  This has enabled the teacher full access and can do whatever they need and take advantage of their unlimited storage in OneDrive for Business without the need of an administrator.

Teachers can come and go throughout a students 5 – 7 years at a school both during a school year and at the end of the academic year and with many systems now integrating with Office 365 Education, users are created automatically from the MIS or finance system.  Of course these systems also can remove users and their licenses from Office 365.  If a users SharePoint or OneDrive license is removed, the OneDrive is still active for another 14 days before the delete it completely removed/deleted.  Of course we don’t want this to happen to the students work so Microsoft have built a PowerShell script around the OneNote Class Notebook API to help transfer these Notebooks between teachers.

Take a look at the link below to the script on GitHub and just remember to transfer the content before that 14 days have run out.

Disable Yammer License in Office 365 Education


A few weeks ago I wrote a blog post about changing licenses from the Office 365 Education license to the Office 365 Plus Education license.  This PowerShell script will help you to make these changes.

In the last week, further integration of Yammer and Office 365 has accord where we can now disable the Yammer license.

I’ve had many customers ask if there was a way we could just allow teachers and admin staff access to Yammer and we haven’t been able to do that until now.

Below are a set of script that will help you to either remove the Yammer license from all users (doesn’t matter what license they have been assigned), keep the current options they have enabled and then removes the yammer option.  The second script will just remove it from users who have a student license.

Remove Yammer license from all users


Remove Yammer from Student assigned accounts only


CSOM of the Day: Introduction


Over the coming few weeks, I’m going to release some of the CSOM, SharePoint Online and PowerShell scripts that I use on a daily basis and use to deploy and configure our customers.  Any questions please do add them to the comments section and I’ll do my best to answer them.

I’ll also through in a few other PowerShell scripts that I use for SharePoint Online and hope you find them useful.

To make them easy to publish meaning I can do more and more and try and get them out as quickly as possible.  Here is a quick explanation of what to look out for in the script.

Add-Type –Path I:UsersAlexSkyDriveDeploymentbinMicrosoft.SharePoint.Client.dll
Add-Type –Path I:UsersAlexSkyDriveDeploymentbinMicrosoft.SharePoint.Client.Runtime.dll

This will import the 2 SharePoint DLLs required to complete commands and connect to Office 365.  Download them from the internet or get them from your SharePoint server.

We then need to connect to the environment giving a URL, username and password.

$username = “”
$password = Read-Host -Prompt “Enter password” -AsSecureString
$siteUrl = “”

When you run this script, you will get a pop out window asking for the password for the user you are connecting as.

We now connect using the URL, username and password using the DLLs.

$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$ctx.Credentials = $credentials

And to finish off, we load the SIte/Web.

$web = $ctx.Web

You will see this section a lot as it loads what we are asking for from SharePoint

Each post will include this but this post will be used as a guide.

I personally like to use the Windows PowerShell ISE so give it a go yourselves.


Get Site Template ID for Custom Site Templates


I have been spending a lot of time in Powershell over the last week and have learnt a lot about how this great tool can customise SharePoint 2010.

As part of the project we have created a set of custom site templates and I had to create a new school with several custom site templates.

In a previous post I have listed the out of the box site templates which you might need to create a site through powershell but now you need to create one with a custom template ID.

To get this ID you need to create a PowerShell file (.ps1) with the below script.

$url = “http://sp2010/”
$site= new-Object Microsoft.SharePoint.SPSite($url )
$loc= [System.Int32]::Parse(1033)
$templates= $site.GetWebTemplates($loc)
foreach ($child in $templates){ write-host $child.Name ”  ” $child.Title}

You will then see the a list of all different IDs and names.


Create SharePoint Site using Powershell


You should becoming increasingly familiar with PowerShell and SharePoint 2010 now and you are building so great scripts to help manage your environment.

A few weeks ago I had the requirement to create over 3000 sites with the site names stored in a Excel spreadsheet.


But first we need to understand how to create a site using Powershell.  The special command is new-spweb which only has 1 requirement and that is the URL of the site but there are several other parameters that you should use when creating a site with Powershell.

Parameter Information
-url Where do you want to create the new site which includes the URL of the new site
-template Add the template number to use the Basic Site or Publishing Site.  A full list here
SharePoint 2010 Site Templates
-name Display name of the site
-AddToTopNav Do you want the site to display in the top navigation bar?
-UseParentTopNav Do you want the site to display in the parent navigation?

Learning PowerShell: Part 2


In my previous post I looked at some of the very basics of PowerShell but now its time to create some scripts.

I’m always building new virtual machines on my laptop and I’m fed up having to add IP Address and how I have click so many times to add this and type in a new computer name.

So thought PowerShell can solve this problem for me.

The first issue I had was that there are some security issues to stop you from just running scripts that change computer settings like this.  First run the command before to change the execution policy on your computer.  You then have to confirm that you want to do this.


Firstly I want the script to prompt me what computer name I want and then the different IP settings for the server.  I type in $NewName=Read-Host “Computer Name”.  If we break this down a little you’ll see the different settings you’ll need for your script.

The $NewName is your variable to store what you have typed.  Later in your script where you type $NewName it will be replaced with what you type when you were prompted.  Where you can see “Computer Name” is the text that will show up on screen as the descriptions of your prompt.

If we run this simple command below it will prompt me for the new computer name and then display it on the screen


Here on the 3rd line you can see it has displayed what we typed when prompted.

To actually change the computer name we need to run 2 lines of PowerShell in our script.

Have a look at the code below and you will notice on the second line it has $newname which is from the prompt earlier.

When adding this to what we already have we the script will change the computer name to what we were prompted.  The computer will then change name after a restart.

A new command line tool that I have started to use in recent weeks since I started looking at Window Server 2008 Core is netsh.exe.  Netsh allows you to control the behaviour of the networking on your windows device.  I change change the IP Address, change the name from Local Area Connection to what ever you want it to be.  I can also change the firewall settings as well.

We’re going to add a few more prompts for the IP Address, Subnet Mask, Default Gateway and DNS Server and these will be used during the netsh commands.

All together we have 3 netsh commands in this script, one will set the IP, Subnet and Default Gateway, one will set the DNS Server and other will turn the firewall off (in my development areas I turn my firewall off).

Below is the full script to change the computer and it will have ask for prompts and add the right information into the script.

Learning PowerShell: Part 1


I’ve been meaning to learn PowerShell for some time now as its an important of SharePoint 2010 and I thought I better get started.  In SharePoint 2010 even if you wanted to try and avoid PowerShell you won’t be able to as this is the best way to patch your farm.

Over the years I have created several batch scripts from collecting computer programs and services installed on all machines on a network, creating all my default Active Directory accounts and a user creation script that adds user to the correct Organisation Unit and AD Group which then allows the user to access the correct sites within SharePoint.  I love these scripts and I love batch files as they have always done what I wanted them to do at the time. But PowerShell is here now and its a new learning curve and I need to learn it.

I’ve played around with it a little before when I’ve mailbox enabled an Active Directory username and it has returned the PowerShell command but that’s cheating as it has already given me the code.  I’m not going to learn it by copying and pasting, I need to work out how to do things and get error messages, do some research and then get the results I want.

Windows PowerShell is  an extensible automation engine from Microsoft, consisting of a command-line shell and associated scripting language (Source: Wikipedia).  It now comes standard with Windows Server 2008 R2 and Windows 7.  There are some built in command that manage the operating system but there are also modules you can add to add command and script against that product.

To import a module you need to know the module name for example Active Directory is activedirectory and to use the Windows Server Manager Console you need to use servermanager

In Windows 7 you also get Windows PowerShell ISE which stands for Integrated Scripting Environment which is a great way to write scripts and see what is going on with errors.  You can run it in this environment to test the script.


As you can see in the middle section of this screenshot when I tried to import the servermanager console returned an error mainly because the module can not be found on this machine.

There are some command line commands that still work in PowerShell, like changing directory is still cd %foldername% or to create a new folder is still md *newnameoffolder*.


There are new commands to do these as well, like change directory is  set-location and create a new folder is  new-item


To me, I prefer the older version – its quicker and I already know this and when it comes to creating a script I still use the older commands.  If you think you are going to have to learn everything in powershell, don’t worry there are some old commands that still work ;-).

The old style batch command were easy to create and they are the same in PowerShell.  Instead of using the .bat extension you have a new one called .ps1.  Microsoft have really helped with editing the file.  If you want to edit the file double click on the file and it will open up in notepad and if you want to run the command you right click on the object and then click Run with PowerShell.  The number of times I’ve gone to edit my batch script and I’ve run it by mistake is not worth counting.  Now I can’t make this mistake again.


I had to do some research for the next part.  I’m in my PowerShell console and I can’t load my .ps1 script.  I type in the file name and it just doesn’t run.  To run your powershell command type in .file.ps1 and it will run it for you.


I’ll keep you updated on how the learning is going.  My objective is to install Active Directory, SQL, Exchange and SharePoint all through PowerShell.