PHPKB Knowledge Base Software Logo  
Guru Corner
Online Knowledgebase System  
Knowledge Base Home Knowledge Base Home
Home > All Categories > Microsoft > Exchange > Office 365 > Connecting to Office 365 using Powershell
Question Title Connecting to Office 365 using Powershell

The most powerful way to manage Office 365 is by using PowerShell, a command line interface that connects to Office 365 via the Internet.

Whilst it may seem daunting to people unfamiliar with working on the Command Line, it really isnít as hard as it looks. This blog post will guide you through the basics of connecting to PowerShell.

Set up your computer to use Powershell

Firstly, you need to set up your computer to be able to use Powershell. This only needs to be done the first time and involves downloading some tools from the Microsoft website.

Here is a link to the tools you will need to install:

You only need to install either the 32bit OR the 64bit tools. If you do not know which tools to install, select the 32bit ones.

Start the Powershell command line

Now that you have the tools installed, you can go ahead and open Powershell. The easiest way to do this is to press the start button and simply type powershell

Powershell in Start Menu

You will now see a Powershell window, and the fun can begin!

Using Powershell

Now that you have a Powershell Window open, you can connect to Microsoft Office 365.

Firstly, you need to create a connection to Office 365. You can do this by typing (or copying/pasting) the following into Powershell.
Note: To paste into Powershell you use Right Click. Here is a great video on how to use Copy and Paste in Powershell

$LiveCred = Get-Credential

Once this is in the Powershell window, press Enter to execute the command.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange-ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection

Connecting to Office 365 using Powershell

Now you simply type in the username and password for an Administrator account in your Office 365 and click OK.

You will probably see some warnings.  Donít worry, they are normal.

You are now authenticated into Office 365. The last step is to connect up to Office 365 by using the following Powershell command:

Import-PSSession $session

Congratulations! Youíre connected!

Now youíve gone to all the trouble of connecting to Powershell, letís do something to prove that it works. Type the following into the Powershell window and press Enter:


You should now see a list of all the users in your Office 365 account that have mailboxes!

Authored by: Guru Corner
Click Here to View all the questions in Office 365 category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
Article Information Additional Information
Article Number: 278
Created: 2013-07-07 3:22 PM
Rating: No Rating
Article Options Article Options
Print Question Print this Question
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Search Knowledge Base Search Knowledge Base

Powered by Guru Corner