PHPKB Knowledge Base Software Logo  
Guru Corner
Online Knowledgebase System  
Knowledge Base Home Knowledge Base Home
Home > All Categories > Microsoft > Exchange > Office 365 > Connect Windows PowerShell to the Service
Question Title Connect Windows PowerShell to the Service

Before you connect, make sure you have the correct version of Windows PowerShell and WinRM installed and configured on your computer.

Verify the account you will use to connect is authorised to connect using Windows PowerShell.

Connect Windows PowerShell on your local computer to the cloud-based service

  1. Click Start > All Programs > Accessories > Windows PowerShell > Windows PowerShell.
  2. Run the following command:
    								$LiveCred = Get-Credential
    
  3. In the Windows PowerShell Credential Request window that opens, type the credentials of an account in your cloud-based organisation. When you have finished, click OK.
  4. Run the following command:
    								$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    
    Note   The AllowRedirection parameter enables cloud-based organisations in datacentres all over the world to connect Windows PowerShell to the cloud-based service by using the same URL.
  5. Run the following command:
    								Import-PSSession $Session
    
    A progress indicator appears that shows the importing of commands used in the cloud-based service into the client-side session of your local computer. When this process is complete, you can run these commands.
Disconnect Windows PowerShell from the cloud-based service

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

						Remove-PSSession 				
						
						

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 will remain open for 15 minutes. Your account can only have three connections to the server-side session at one time.



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: 263
Created: 2013-01-13 12:36 AM
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