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.

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

[box]

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

[/box]

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;

[box]

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

[/box]

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;

[box]

$UserCredential = Get-Credential

[/box]

Then connect the the Exchange Server;

[box]

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

Import-PSSession $Session -DisableNameChecking

[/box]

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

[box]

Remove-PSSession $Session

[/box]

Related Articles, References, Credits, or External Links

NA

Leave a Reply

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