Starting Exchange Management Shell in Windows PowerShell
In our previous blog posts (e.g. How to check the number of autoreply emails sent from Exchange) we described various tools and methods utilizing Exchange Management Shell. Since EMS is nothing more than a normal PowerShell console, just with special Exchange module loaded it should be possible to run these Exchange cmdlets (e.g. get-transportagent) directly in the Windows PowerShell, without looking for the EMS shortcut. This is also helpful when you mistakenly launch Windows PowerShell console with the Exchange cmdlet in mind only to discover that it does not work.
Below you’ll find two alternative methods of running Exchange PowerShell instead of using the Start menu shortcut. Please note that these solutions work only when you’re logged on directly on the Exchange Server.
Execute a special script from the EMS shortcut directly in the PS console.
If you right click the EMS shortcut and open its properties you’ll notice that it contains specific PS script file as a parameter:
A full name of this script parameter is as follows:
. 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'
Therefore, it is a matter of running it in the standard PowerShell window. Make sure that you launched the PS console with the administrative privileges. Additionally if you want to run it on Exchange 2013 make sure to replace the “V14” part of the script path to “V15”.
As the resulting screen suggests - the Exchange Powershell cmdlets are successfully imported. However, there is one last step to perform. Run the following command to complete the EMS launching process:
Connect-ExchangeServer -auto
You are now ready to run typical Exchange cmdlets.
Add the Exchange snapin in the PS console.
This method is fairly easy as it requires running only one command in the normal PowerShell console:
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010
After the snapin loads, you are ready to run cmdlets. Unfortunately, this method does not support all available Exchange commands.
There is also another way of running Exchange Management Shell in the standard Windows Powershell console via Powershell Remoting. With this method, you can run scripts on your server even from the remote workstation without the need to launch it directly on the Exchange machine.
To learn more visit MSH Exchange Autoresponder website.