Connect to Exchange servers using remote PowerShell

If you don’t have Exchange management tools installed on your computer, you can use Windows PowerShell to create a remote session to an Exchange server.  Open Windows PowerShell on your computer and run the following commands:

To Connect

The first step is to specify the credentials you will be using to connect because, in an ideal environment, your local account will not have access to an Exchange Server.

$UserCredential = Get-Credential
Code language: PowerShell (powershell)

Next, we need to create a PowerShell session to the Exchange server.  You will need to specify the Exchange server FQDN (Fully Qualified Domain Name).  e.g.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<ServerFQDN>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Code language: PowerShell (powershell)

Then we import the session to establish the connection.

Import-PSSession $Session -DisableNameChecking
Code language: PowerShell (powershell)

After you run the above command, you can check to make sure everything worked as expected by running a simple Get-Mailbox command to see if you get any results.

To Disconnect

To disconnect the session just execute the following.

Remove-PSSession $Session
Code language: PowerShell (powershell)