≡ Menu

Quick Tip: Add Exchange Management Shell Menu Item in PowerShell ISE

The PowerShell Integrated Scripting Environment (ISE) is a great tool for writing, testing and debugging scripts. Since I don’t use the ISE exclusively for Exchange scripting, I don’t really need to import the EMS cmdlets everytime I start the ISE. So, I added a custom item to the ISE tools menu that I can use to import the Exchange Management Shell cmdlets whenever it is convenient. To do this, add the following code to your ISE-specific profile (for example: Microsoft.PowerShellISE_profile.ps1). Change the server name to use one of your Exchange 2010 servers:

  "Connect to Exchange",
        $s = New-PSSession -ConfigurationName Microsoft.Exchange `
        -ConnectionUri http://adatum-ex1.adatum.com/PowerShell/ `
        -Authentication Kerberos

        Import-PSSession $s

If you don’t want to hard code the server name, you can replace the code in the script block in the with the code from this post. It will import the cmdlets from a random Exchange server in the local AD site.

After you reload your profile or restart the ISE, you’ll have a new item under the Add-Ons menu:

Click on Connect to Exchange, or use the keyboard shortcut Ctrl+Alt+Z (you can change this). When the code executes, the Exchange Management Shell cmdlets will be imported using implicit remoting:

At this point, you are ready to start running Exchange Mangement Shell commands in the ISE. Of course, if you’re not looking to do anything fancy you can just load the EMS cmdlets in your ISE-specific profile (there is an example of how to load EMS cmdlets from a profile with implicit remoting in this post) but I thought this was kind of a cool tip. If you haven’t worked with the ISE much and want to learn more about it, check out the ISE Help on TechNet.

6 comments… add one

  • eiger3970 November 8, 2010, 6:56 pm

    Starting the Exchange Management shell states: ‘Just’

    click Start, click All Programs, Microsoft Exchange

    Server 2010, and then Exchange Management Shell.
    Unfortunately, my Windows Server 2008 R2 Standard

    doesn’t show Microsoft Exchange Server 2010 in All

    Programs…or anywhere? All Programs does show Exchange

    Management Console, which I have opened.
    I still can’t find this Exchange Management Shell.

    However, I have clicked on Exchange Management Console,

    View, View Exchange Management Shell Command Log….
    This show the command log, however I can’t enter the

    command Set-RpcClientAccess –Server Exchange_server_name

    –EncryptionRequired $False which I need to turn off the

    RPC as my client pcs won’t access the email server, with

    the error ‘There is a problem with the proxy server’s

    security certificate. The security certificate is not

    from a trusted certifying authority. Outlook is unable

    to connect to the proxy server

    EX2010.xxxxxxxxxxxx.local. (Error Code 8).

  • ixobelle August 22, 2011, 8:31 am

    works great, thanks

  • BaddaWho September 5, 2011, 2:38 pm

    I don’t seem to have an Add-On’s menu when I launch ISE. Also I ran the $profile command and it gave me the path to the profile file,but when I go there, there’s nothing there. (Even with Hide system files and folders unchecked)

  • Mike Pfeiffer September 7, 2011, 11:43 am

    You’ll need to create the profile script manually. The variable simply contains a reference to the location. If you create the profile script and add the code (also make sure your execution policy allows scripts to run) then you should have the addons menu the next time you start the ISE.

  • BeeRye May 1, 2013, 12:51 pm

    Great article! Works perfect!

  • Isaac June 5, 2014, 1:59 pm

    Hi Mike, how would you import the Exchange Management Shell cmdlets in a PSWA session?(PSWA is loaded on the same exchange 2013 server)

Leave a Comment