Exchange 2019 / 2016 Manage Remotely via PowerShell

KB ID 0001465

Problem

Since Exchange 2013 we have been able to manage Exchange remotely through the Exchange Admin Center, but what if you want to use the Exchange Management Shell remotely?

Install Exchange Management Tools

This is not just the Management Shell, this will also install the Toolbox and additional help.

Install-Exchange MGMT-Tools

There are few prerequisites, but to install from a normal PowerShell prompt;

Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementScriptingTools,IIS-ManagementScriptingTools,IIS-IIS6ManagementCompatibility,IIS-LegacySnapIn,IIS-ManagementConsole,IIS-Metabase,IIS-WebServerManagementTools,IIS-WebServerRole

./Setup.exe /Role:ManagementTools /IAcceptExchangeServerLicenseTerms

Install-MGMT-Tools

Once Installed, You can launch the Shell itself, or you can add the Exchange PowerShell commandlets to a normal Powershell session, with the following command;

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;

Add Exchange PowerShell Snapin

For older versions of Exchange, the commands are slightly different;

  • Exchange 2010: Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010;
  • Exchange 2007 :Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin;

Connect to Exchange Remotely (via PowerShell)

It’s a Windows server after all, so you can bring up a remote session, first give it an account with some Exchange administrative privileges;

$UserCredential = Get-Credential

PowerShell Remote Manage Exchange

Then connect the the Exchange Server;

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://Server-Name/PowerShell/ -Authentication Kerberos -Credential $UserCredential

Import-PSSession $Session -DisableNameChecking

PowerShell Remote Manage Exchange 2016

Note: As above, don’t forget to disconnect the session the you have finished.

Remove-PSSession $Session

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *