Extending the PowerShell ISE with Exchange functionality

Need to do some serious PowerShell scripting around Exchange? Then Notepad probably won’t cut it, no syntax highlighting, online help etc. The solution is to extend the PowerShell Integrated Scripting Environment (ISE) with Exchange functionality.
It’s actually quite easy. First, let’s examine what the “Exchange Management Shell” shortcut does:

Open the file location, right click on the link and open its properties:

This is what happens when you start the Exchange Management Shell:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command “. ‘C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto -ClientApplication:ManagementShell

We’re only interested in the last two commands, highlighted in bold above:

. ‘C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1’
Connect-ExchangeServer -auto -ClientApplication:ManagementShell

The first loads the Exchange extensions, while the second commands connects to an Exchange Server. Don’t forget the “.” In front of the first command…

Now fire up PowerShell ISE, and execute the commands:

As you can see I was able to connect to Exchange and get a list of all mailboxes.

And the integration also extends into the scripting environment:

Last but not least, the integrated help is also extended. If you don’t see it right away, you might have to hit Refresh.

One thought on “Extending the PowerShell ISE with Exchange functionality

Leave a Reply

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