Learn how to access your organization's Exchange Environment remotely using Microsoft PowerShell
For Exchange Online
- Open Windows PowerShell on your computer as administrator and enter the following command:
Install-Module -Name ExchangeOnlineManagement
This will install the necessary component to access Exchange Online via PowerShell.
If prompted, type "Y" and then hit the Enter key to confirm the installation.
- The next step is to authenticate your user, which you can do by typing in the following command and then hitting the Enter key:
A sign in pop-up should appear. Type in the credentials of the account you want to access Exchange Online with (the account needs the Global Admin role within Exchange):
- After typing in the credentials, you should see a screen similar to this one:
If you do not see an error message (typically with red letters), it means you are correctly authenticated.
- Run the following command to activate the necessary Exchange module:
For Exchange 2013
Execute the following commands in PowerShell, where CAS FQDN is the fully qualified domain name of an Exchange 2013 Client Access Server:
$Credentials = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://<CAS FQDN>/PowerShell/" -Authentication Kerberos -Credential $Credentials
You will be asked to supply valid Exchange credentials.
No matter if you are using Exchange Online or Exchange 2013, you should disconnect the remote PowerShell session when you are finished by executing the following command: