Category Archives: Outlook Live

Connect Windows PowerShell to Outlook Live

After you have installed and configured Windows PowerShell and Windows Remote Management (WinRM) on your computer, you have to connect the Windows PowerShell on your local computer to Outlook Live to perform tasks in your Outlook Live organization.

When you open Windows PowerShell on your computer, you’re in the Windows PowerShell session of your local computer. A session is an instance of Windows PowerShell that contains all the commands that are available to you.

The Windows PowerShell session of your local computer, called the client-side session, only has the basic Windows PowerShell commands available to it. By connecting to Outlook Live, you connect to the Outlook Live server environment, called the server-side session, which contains the Outlook Live commands.

Before you begin

Before you connect, make sure you have the correct version of Windows PowerShell and WinRM installed and configured on your computer. For more information, see Install and Configure Windows PowerShell.

Verify the Outlook Live account you will use to connect is authorized to connect using Windows PowerShell. For more information, see Control Users’ Access to Windows Remote Management.

Connect Windows PowerShell on your local computer to Outlook Live

  1. Click Start > All Programs > Accessories > Windows PowerShell > Windows PowerShell.
  2. Run the following command:

$LiveCred = Get-Credential

  1. In the Windows PowerShell Credential Request window that opens, type the Windows Live ID and password of an Outlook Live account. When you are finished, click OK.
  2. Run the following command:

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

Note   The AllowRedirection parameter enables Outlook Live organizations all over the world to connect Windows PowerShell to Outlook Live by using the same URL.

  1. Run the following command:

Import-PSSession $Session

A progress indicator appears that shows the importing of Outlook Live commands into the client-side session of your local computer. When this process is complete, you can run Outlook Live commands.

Disconnect Windows PowerShell from Outlook Live

When you’re finished using the Outlook Live server-side session, always disconnect Windows PowerShell from Outlook Live by running the following command:

Remove-PSSession <Outlook Live session variable>

For example, to disconnect from the server-side session that is defined by the $Session variable, run the following command:

Remove-PSSession $Session

Important   If you close the Windows PowerShell window without disconnecting from the server-side session, your connection to Outlook Live will remain open for 15 minutes. Your account can only have three connections to the server-side session at one time.

Leave a comment

Posted by on September 21, 2011 in Outlook Live, PowerShell