Saturday, August 9, 2014

Install Powershell for SharePoint 2013 Online

 

1. Working with Office 365 using PowerShell:

Windows Server 2008 R2 by default has Windows PowerShell 2.0 which does not support SharePoint office 365 object tools. We need to update the Windows PowerShell 2.0 to 3.0.

Below are the prerequisites and procedure to install/configure PowerShell 3.0.

2. Prerequisites:
2.1 Install PowerShell 3.0 on Windows server 2008 R2 / Windows 7:

We can check the current version of the PowerShell using the command ”$PSVersionTable” in Windows PowerShell.

clip_image002

2.2 Install the .NET Framework 4.0 :

ü Windows PowerShell 3.0 requires .NET Framework 4.0. The easiest way to find the Windows PowerShell 3.0 download package is to access it directly from the Microsoft TechNet Script Center.

clip_image004

ü Go to the Windows PowerShell 3.0 download pages. The download page is shown as below:

clip_image006

ü Determining which version of the package to download, and also need to know version of computer we have (for example, is it 64-bit or x86). Get this information from Windows PowerShell. The command used is:

PS C:\Users\administrator> $env:PROCESSOR_ARCHITECTURE

x86

ü The available packages and the applicable operating system are listed here:

Windows 7 Service Pack 1:

· 64-bit versions: Windows6.1-KB2506143-x64.msu

· 32-bit versions: Windows6.1-KB2506143-x86.msu

Windows Server 2008 R2 SP1:

· 64-bit versions: Windows6.1-KB2506143-x64.msu

Windows Server 2008 Service Pack 2:

· 64-bit versions: Windows6.0-KB2506146-x64.msu

· 32-bit versions: Windows6.0-KB2506146-x86.msu

ü Download and install the package.

clip_image008

Note:   Make sure you have Windows PowerShell closed prior to performing the actual installation.

clip_image010

ü When the installation completes, it requests a reboot. Following the reboot, Windows does a bit of configuration that will take a couple of minutes. The following screen displays during the configuration.

clip_image012

ü Open the Windows PowerShell console and type $psversiontable. The following data returns:

clip_image014

ü Check out the new version of the Windows PowerShell ISE. The new Command Add-On, the single Windows PowerShell console pane, the Click to run feature. This is shown here:

clip_image016

3. SharePoint Online Management shell :

SharePoint Online Management Shell is a Windows PowerShell module that you can use to efficiently manage SharePoint Online users, sites, site collections, and organizations. Command-line operations in Windows PowerShell are composed of cmdlets. A cmdlet, pronounced "command-let," is a verb-noun pair that is always separated by a hyphen (-) without spaces Install the SharePoint Online Management Shell from the Microsoft Download Center.

· Install the SharePoint Online Management Shell from the Microsoft Download Center.

clip_image018

clip_image020

· Select the 64-bit version of the package, permit pop-ups, and say it can run with Admin rights. I am presented with the following:

clip_image022

· After I accept the license agreement and click Install, the installation runs to completion.

clip_image024

· Open the Windows PowerShell console with Admin rights, and once again I use the Get-Module –ListAvailable command.

Get-Module -ListAvailable *Online.SharePoint*

clip_image026

Import-Module 'C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell'

· Press ENTER and import the module, if the following warning message apears, which states that the module contains some unapproved verbs. This means it needs to look for other than the standard Get and Set types of verbs, but the module should work anyway.

clip_image029

4. Connect to the SharePoint Online service:

To connect the SharePoint Online Service, Use the Connect-SPOService cmdlet. The command is a bit complex, and if we are going to do this on a daily basis, it would be better to write a function to include in my profile. More about that in a minute, but for now, here is the Connect-SPOService command:

Connect-SPOService -Url <<SharePoint Online Admin Center URL>> -Credential (Import-Clixml C:\fso\cred.xml)

Note Keep in mind that credentials are stored in a Cred.xml file.

After we type this command, we are connected to the SharePoint Online site.

Function is shown here:

Connect-SharePointOnline

Function Connect-SharePointOnline

{

$cred = Import-Clixml C:\fso\cred.xml

Import-Module 'C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell' -DisableNameChecking

Connect-SPOService -Url https://ScriptingGuy-Admin.SharePoint.Com -Credential $cred

}