Skip to content

Connect to Exchange servers using remote PowerShell

Last updated on Oct 8, 2019

Connect to Exchange servers using remote PowerShell

If you do not have local access to your Exchange server, you can use Exchange remote PowerShell to connect to your Exchange Servers.

To get started open PowerShell on your local computer.

  1. Type the following
 $UserCredential = Get-Credential
A screenshot of a cell phone

Description automatically generated
  1. The create the new PSSession (Change the FQDN to that of your Exchange Server)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://EX01.ThatLazyAdmin.local/PowerShell/ -Authentication Kerberos -Credential $UserCredential
A screenshot of a cell phone

Description automatically generated
  1. Lastly the new PS Session needs to be imported as follows.
Import-PSSession $Session -DisableNameChecking
A close up of a logo

Description automatically generated
A screenshot of a cell phone

Description automatically generated

How to verify if it worked?

You can run the following cmdlet to get a list of mailboxes.

Get-Mailbox
A picture containing electronics, battery

Description automatically generated

Sharing is caring!

Published inExchange ServerPowerShell

2 Comments

  1. Carlos Carlos

    I am encountering the error: ” New-PSSession : A positional parameter cannot be found that accepts argument ‘Powershell/’.” At line:1 char:12
    + $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [New-PSSession], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewPSSessionCommand

    Granted PS is not my strongest skill. What could it mean?

    • Hi Carlos, please use the below to connect to exchange. Hope this helps
      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://EX01.ThatLazyAdmin.local/PowerShell/ -Authentication Kerberos -Credential $UserCredential

      In the post, the Url is missing a “/” before PowerShell. apologies for that.

Leave a Reply

Your email address will not be published.