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.
- Type the following
$UserCredential = Get-Credential
![A screenshot of a cell phone
Description automatically generated](http://www.thatlazyadmin.com/wp-content/uploads/2019/07/a-screenshot-of-a-cell-phone-description-automati-5.jpeg)
- 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](http://www.thatlazyadmin.com/wp-content/uploads/2019/07/a-screenshot-of-a-cell-phone-description-automati-6.jpeg)
- Lastly the new PS Session needs to be imported as follows.
Import-PSSession $Session -DisableNameChecking
![A close up of a logo
Description automatically generated](http://www.thatlazyadmin.com/wp-content/uploads/2019/07/a-close-up-of-a-logo-description-automatically-ge-2.jpeg)
![A screenshot of a cell phone
Description automatically generated](http://www.thatlazyadmin.com/wp-content/uploads/2019/07/a-screenshot-of-a-cell-phone-description-automati-7.jpeg)
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](http://www.thatlazyadmin.com/wp-content/uploads/2019/07/a-picture-containing-electronics-battery-descrip.jpeg)
![](http://www.thatlazyadmin.com/wp-content/uploads/2018/06/word-image-14.png)
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.