Add Exchange Online Shell to Windows Terminal

I really like the Windows Terminal – an awesome tool which I use daily. Some time ago, I posted my My Windows Terminal Config. These days, I added the Exchange Online Shell as another option in my config. Here is how you can add it.

Note: Exchange Online Shell does not work within powershell core, that’s why we use standard powershell.

Step 1: Install ExchangeOnlineManagement

Open Powershell (not core) as administrator and install the module “ExchangeOnlineManagement”:

Install-Module ExchangeOnlineManagement

Step 2: Verify if it works

Import-Module ExchangeOnlineManagement
# sign in

If Connect-ExchangeOnline throws:

Could not load type ‘System.Security.Cryptography.SHA256Cng’ from assembly ‘System.Core, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’ …

switch to “classic” Powershell. This error occurs if you use Powershell Core. ExchangeOnlineManagement only works within Powershell.

Step 3: Add Exchange Online to Windows Terminal

Open settings of Windows Terminal and add:

        "guid": "{2f59be3b-a8a2-4131-98c9-e8531cbc4dd9}",
        "name": "Exchange Online Shell",
        "commandline": "powershell.exe -NoExit -Command \"Import-Module ExchangeOnlineManagement; Connect-ExchangeOnline\"",
        "background": "#012456",
        "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png"

If you always use the same user, you can add “-UserPrincipalName [email protected]” to the config:

        "guid": "{2f59be3b-a8a2-4131-98c9-e8531cbc4dd9}",
        "name": "Exchange Online Shell",
        "commandline": "powershell.exe -NoExit -Command \"Import-Module ExchangeOnlineManagement; Connect-ExchangeOnline -UserPrincipalName [email protected]\"",
        "background": "#012456",
        "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png"

My entire Windows Terminal config



7 Responses

  1. How did you come up with the GUID for the profile?
    I’ve read you need to use a UUID V5 generator, but I’ve not had any success.

  2. Does that GUID not have any bearing on the name of the profile?

    I was trying to come up with the Ubuntu GUID shown in the Microsoft document below by running it through various Version 5 UUID generators, but could never come up with the GUID shown.

    My understanding was that the GUID needed to be generated based on the profile name. But I could be completely misunderstanding all of this.

  3. Awesome tip! I use the Exchange Online to manage delegated organizations using the
    flag. I wonder if your command line could be modified to prompt for the domain name? I played around with it for a bit, but couldn’t get it to work.

    • what a great idea! I have multiple profiles for that, but you could also use the following:

      "commandline": "powershell.exe -NoExit -Command \"Import-Module ExchangeOnlineManagement; $server = Read-Host -Prompt 'Input your server name'; Connect-ExchangeOnline -UserPrincipalName [email protected] -DelegatedOrganization $\"",

Leave a Reply

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