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 that the account you will use to make the connection is authorized to connect by using Windows PowerShell. For more information, see Control Users' Access to Windows Remote Management.
- Click Start, point to All Programs, click Accessories, click Windows PowerShell, and then click Windows PowerShell.
- Run the following command:
- In the Windows PowerShell Credential Request window, type the credentials of an account in your cloud-based organization. Then, click OK.
- 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 organizations in datacenters all over the world to connect Windows PowerShell to the cloud-based service by using the same URL. - Run the following command:
Commands that are used in the cloud-based service will now be imported into the client-side session of your local computer, as tracked by a progress bar. When this process is complete, you can run these commands.
When you're finished using the server-side session, always disconnect Windows PowerShell by running the following command:
For example, to disconnect from the server-side session that is defined by the $Session variable, run the following command:
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 have only three connections to the server-side session at one time.
After you've connected to the server-side session, you're ready to perform tasks in the cloud-based service. For detailed instructions, see Use Windows PowerShell in Exchange Online.