Run Exchange command from Windows Powershell

Mike picture Mike · May 2, 2018 · Viewed 9.5k times · Source

I've connected to EMS from Windows Powershell using the below:

&"C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1 "

I can't run Get-ExCommands or Disable-Mailbox -Identity Test without getting an error. "The term Get-ExCommands is not recognized as the name of a cmdlet, function, script..."

Is it possible to run Exchange commands in Win Powershell?

Answer

TomG picture TomG · May 2, 2018

This works fine for me:

. 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'
Connect-ExchangeServer -auto

If you did not install the Exchange Management Tools on the server you are using you can connect to exchange this way:

$s = New-PSSession -ConnectionUri http://putyourservernamehere/Powershell  -ConfigurationName Microsoft.Exchange 
import-pssession $s