
When selecting “Connect to Exchange Online” (or pressing the configured keyboard shortcut), ISE will execute the associated code block the progress is displayed in the output window. $o365Session= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $o365Cred -Authentication Basic -AllowRedirectionĪfter starting ISE you’ll see the Add-ons menu now contains three extra items: $env:ExchangeInstallPath\bin\RemoteExchange.ps1 $ExSession= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Authentication Kerberos Now, in the Microsoft.PowerShellISE_profile.ps1 file, add the following contents: $.Add(


Note that the example won’t be using stored credentials and will let ISE prompt the user for credentials when required, which is perfectly fine if you need to access different Office 365 tenants for example. Loading the Exchange 2010 Snap-in and connecting to Exchange using Autodiscover (unsupported, will bypass RBAC).Implicit Remoting to connect to Exchange using a static FQDN.The file doesn’t exist by default, so when required you can simply create the file in the proper location using notepad $profile. To automatically load the custom entries after starting up ISE, we’re going to define the entries in our default ISE profile file, Microsoft.PowerShellISE_profile.ps1, which location is stored in $profile. Optionally, you can assign a keyboard shortcut to the menu option.Action, which can be a PowerShell cmdlet, scriptblock or function.Display Name, which is used for displaying the menu item.To add custom menu options to ISE, we’re going to add items to the submenu of $, which is “Add-ons”. For example, you can explore ISE through the $psise object:

One of the powerful features of ISE is that it allows customizing through the ISE object model. Depending on the script I’m working on and for what customer or environment, I may need to add snap-ins or switch contexts, like connecting to Exchange Online. I’ve become a fan of using the PowerShell Integrated Scripting Environment (PowerShell ISE) for creating, testing and debugging scripts, using breakpoints and step-by-step execution features found in many development environments.
