Script: Connect-365.ps1 – Connect to Office 365 services using remote PowerShell

I’m excited to announce the release of Connect-365! Back 2012, I put together a basic script with a GUI to simplify connecting to Exchange Online via remote PowerShell. I had never intended to make the script publicly available and it was just something I used myself. After a couple years I realized that it had been shared with so many colleagues and clients that I decided to clean it up and publish it on the TechNet gallery. Connect-EXO was born! Here’s a screenshot of the original first version:

Over time the script matured into what Connect-EXO is today. One of the challenges in the early version was that I used WPF for the GUI, this was problematic for older versions of PowerShell so I made the decision to port it to Windows Forms for backward compatibility. Forms is old and added a lot of bloat and since backwards compatibility is no longer a concern, I decided to move back to WPF. Connect-365 is essentially the next version of Connect-EXO, I renamed it so more accurately reflect it’s purpose and this will allow me to continue to maintain Connect-EXO.

Connect-365 features a GUI that will prompt for your tenant credentials and then connect to various Office 365 services using remote PowerShell. The built-in prerequisite checker will check to ensure that the correct modules are installed and provide a download link for those that are not.

The current version of the script allows connectivity to:

  • Exchange Online
  • Azure Active Directory (using v2 module)
  • Office 365 Security & Compliance Center
  • Skype for Business Online
  • SharePoint Online

Requirements:
This script will work natively in PowerShell 4.0+

Usage:
There are no parameters or switches, simply execute the script: .\Connect-365.ps1

Execution Policy:
This script has been digitally signed and will run just fine under a “RemoteSigned” execution policy

Screenshots:

Roadmap:

  • Support Azure AD v1 and v2
  • Support for Exchange Online MFA (via module)
  • Derive SPO Admin URL
  • Auto-install prerequisites
  • Much more..

Download:
I have published it to the TechNet Gallery, it can be downloaded by clicking here…

Post navigation


Comments

  • Pat Richard

    Cool stuff. Have you thought about running it through PSSharper (part of ISEsteroids) in ISE? It’s making a few suggestions.

  • Chris

    Hey Pat,

    Thanks for the suggestion, I’ll definitely check it out.

    Cheers,

    Chris

  • Onlabs

    Hello, I read your roadmap about install auto install prerequisites, maybe you can use the work of https://gallery.technet.microsoft.com/scriptcenter/O365InstallsConnectionsps1-e4821bf1
    (careful, the download links is outdated and Azure AD in version 1).

    In addition, you could add to parameters:
    -install : to install as a module (like the script above)
    -commandline : to launch the script in command line (in fact, it is more flexible when we want to use your script in another big script)

    Post your script on github could be interesting for collaboration on it 🙂

  • Chris

    Thanks for the info. I’ve been considering GitHub, will definitely give it some thought.

  • Urs Rau

    Hi Chris, Great stuff thanks. When trying to run it from powershell core 6 it complies about
    [System.Reflection.Assembly]::LoadWithPartialName(‘presentationframework’) being a problematic way
    Avoid Binding on Partial Assembly Names from best practice document and apparently ‘presentationframework’ is an obsoleted dll in framework 4.5 and newer.
    “This method has been deprecated. Please use Assembly.Load() instead.”
    Can you rework this and use the more modern approach so it has a chance of eventually working across win/mac/linux on powershell core

  • Chris

    Thanks for the feedback – I’ll definitely look into this.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>