Upgrading SharePoint Online\Office 365 site from 2010 to 2013 using PowerShell

As of the 27th February existing Office 365 tenants are able to self-upgrade their sites to the updated wave 15 version of SharePoint online.  Sites can be upgraded on an individual basis using the UI, but if you want to upgrade multiple sites as part of a process it is (in my opinion) easier to do this via an automated script.

The following sections provide an overview of one way of achieving this goal.

Pre-Requisites

There are a number of pre-requisites which will need to be installed, these include the following.

Operating Systems

Supported Operating Systems
Windows 7
Windows 8
Windows Server 2008R2
Windows Server 2012
Windows Server 2012 R2

Supporting Software

Name Download Location
Windows Management Framework 3.0 http://www.microsoft.com/en-us/download/details.aspx?id=34595
.NET Framework 3.51
Microsoft Online Services Sign-in Assistant http://go.microsoft.com/fwlink/?LinkId=286152
SharePoint Online Management Shell http://go.microsoft.com/fwlink/p/?linkid=236297

Optional Software

Name
PowerShell Editing Tool
XML Editing Tool

Setup the Environment
In order to run SharePoint Online PowerShell commands a number of steps need to be completed, these are as follows Depending on the operating system of the server\pc which is being used to run the PowerShell, you may need to install some .NET Framework 3.51 and then the Windows Management Framework application. Once this has been done (if required), the Microsoft Online Services Sign-in Assistant and the SharePoint Online Management Shell tools need to be installed. This completes the initial setup of the scripting environment.

Creating the Script
When processing multiple items using PowerShell it is advisable to create a separate file, which contains the values\properties of the items that will be processed. One way of achieving this is to use an xml configuration file. An example of a configuration file is shown below:

<?xml version=1.0 encoding=utf-8?>
<configuration>
    <sites>
       <site name=Site 1” URL=[URL of Site Collection] />
       <site name=Site 2 URL=[URL of Site Collection] />
       <site name=Site 3 URL=[URL of Site Collection] />
       <site name=Site 4 URL=[URL of Site Collection] />
       <site name=Site 5 URL=[URL of Site Collection]” />
   </sites>
</configuration>

This file can be extended to include more site collections as and when required.

PowerShell Commands
The commands to upgrade a site collection are not complex and consists of 3 core commands, which are shown below.

Command Description
Import-Module Used to import the Microsoft Online SharePoint PowerShell Module. Example: Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService Connects to the office 365 administrative site. Example: Connect-SPOService –URL “Admin URL” –Credential “Admin Account”
Upgrade-SPOSite Upgrade the site selected collection. Example: Upgrade-SPOSite –Identity “Site Collection URL” -VersionUpgrade

Processing Multiple Sites
The following code will process all the sites from a config file (as defined in section 2.2.2) and submit an upgrade request to the Office 365 tenant,

#Import the config File $Global:SolutionConfig = [xml](Get-Content “Path to Config File”);

#Import the SharePoint Online Module.

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

#Connect to the Online Service

Connect-SPOService -Url “URL” -Credential “[Admin Account]”

foreach($site in $SolutionConfig.Configuration.Sites.Site)

{     

    #Loops through sites in config file and sends the upgrade command.     

    -SPOSite -identity $site.URL -VersionUpgrade

}

Save this as a .ps1 file and run it from the SharePoint Online Management Shell.

Leave a comment

Website Built with WordPress.com.

Up ↑