
Remote Connection Online
This documentation is archived and is not being maintained.
Remote PowerShell allows you to manage your Exchange Online Protection settings from the command line. You use Windows PowerShell on your local computer to create a remote Shell session to Exchange Online Protection. It’s a simple three-step process where you enter your Office 365 credentials, provide the required connection settings, and then import the Exchange Online Protection cmdlets into your local Windows PowerShell session so that you can use them.
Windows 10
* You need to install the Microsoft.NET Framework 4.5 or later and then either the Windows Management Framework 3.0 or the Windows Management Framework 4.0. For more information, see Installing the .NET Framework and Windows Management Framework 3.0 or Windows Management Framework 4.0.
Files cannot be loaded because running scripts is disabled on this system. Provide a valid certificate with which to sign the files.
To enable Windows PowerShell to run signed scripts, run the following command in an elevated Windows PowerShell window (a Windows PowerShell window you open by selecting Run as administrator):
Set-ExecutionPolicy RemoteSigned
You need to configure this setting only once on your computer, not every time you connect.
- On your local computer, open Windows PowerShell and run the following command.
$UserCredential = Get-Credential
In the Windows PowerShell Credential Request dialog box, type your Office 365 user name and password, and then click OK.
- Run the following command.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection
Notes:
-
For Office 365 Germany, use the ConnectionUri value: https://ps.protection.outlook.de/powershell-liveid/
- For Exchange Online Protection subscriptions that are Exchange Enterprise CAL with Services (includes data loss prevention (DLP) and reporting using web services), use the ConnectionUri value:
-
Import-PSSession $Session
Be sure to disconnect the remote PowerShell session when you're finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command.
Remove-PSSession $Session
After Step 3, the Exchange Online Protection cmdlets are imported into your local Windows PowerShell session and tracked by a progress bar. If you don’t receive any errors, you connected successfully. A quick test is to run an Exchange Online Protection cmdlet, for example, Get-TransportRule, and see the results.
If you receive errors, check the following requirements: