Connect-365.ps1 - Connect to Office 365 services using remote PowerShell

A GUI script that simplifies the process of connecting to Office 365 services using remote PowerShell.

4.6 Star
8,786 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Failes to collect MFA credentials after repeated attempts
    2 Posts | Last post July 01, 2019
    • It pops up the credential window for a split second and then continues to run without credentials and fails with 'Exchange Online error.  Connection failed, please check your credentials and try again.'
    • Could you give me a little more info about the issue you are having? I literally use this every day and cannot replicate it. Feel free to contact me here: 
  • Possible Bugs
    6 Posts | Last post May 16, 2019
    • hi There.
      On the prerequisite Checker:
      1.- the Exchange Online download link no longer works
      2.- the teams status is always Failed.
    • Hello,
      Thanks for the report. The exchange link js , that link seems to work for me. Can you be more specific about the error that you are receiving?
      I'll info the Teams status, are you saying that it says failed but does allow you to connect?
      Could you also let me know what version of Windows and PowerShell you are using?
    • Windows 10 Enterprise 1809 build 17763.437.
      PowerShell 5 1 17763 316
      On the prerequisite Checker, When I click on the download, the browser tries to open the URL but then closes the tab and do nothing. 
      Manually going to The link worked with no issues.
      I tried on different computers and browsers. Firefox gives a security warning and the closing tab seems to be only on Edge.
      After installing the module from the link the prerequisite Checker detected the installation.
      Regarding the teams module. It still does not detect the module. I installed it using Install-Module -Name MicrosoftTeams 
      Probably the issue is that a new version was released 22 days ago.
    • I have tried to connect to both Exchange and Teams. 
      Exchange Online error. Connection failed, please check your credentials and try again..
      Teams error. Connection failed, please check your credentials and try again..
      Connection to AzureAD works.
    • The problem was on my end..
      Forgot to run Set-ExecutionPolicy RemoteSigned
      After that, the teams module was correctly detected and connections worked.
    • Thanks for the update.
  • Office 365 PS missing
    4 Posts | Last post March 14, 2018
    • Hello,
      The script is perfect and really helpful.
      But Is it possible to use it to connect to the actual Office 365 Admin Powershell, instead of running the addition Connect-MsolService?
      Am I missing something?
    • Yes it is possible, just select the "Azure AD" Option.
    • I think what @José Ureña Guevara is asking is that there seems to be a bug when trying to connect to azure ad. It says it has connected but it doesn't actually connect. Once you've entered the username and passwords etc, you get the successfully connect prompt but running get-msoluser returns a " You must call the Connect-msolservice cmdlet"
      Sample output below.
      Your username is: xxxx@domain . xxxx
      You are now connected to:
      -Exchange Online
      -Azure Active Directory
      09:09:25: Scripts> get-msoluser
      get-msoluser : You must call the Connect-MsolService cmdlet before calling any other cmdlets.
      At line:1 char:1
      + get-msoluser
      + ~~~~~~~~~~~~
          + CategoryInfo          : OperationStopped: (:) [Get-MsolUser], MicrosoftOnlineException
          + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.MicrosoftOnlineException,Microsoft.Online.Adm
      09:11:32: Scripts> connect-msolservice
      <re-enter password information here>
      09:12:20: Scripts> (get-msoluser).count
      Incidentally there is mention about version 3 of the script in some of the other comments but the download from the gallery page says version 1.0, creation 3/14/2017
    • Sorry about the delayed reply. I didn't get a notification about this comment and I don't check these daily. Haha.
      Connect-365 uses the Azure AD V2 module, which means get-msoluser will not work, that cmdlet is V1. V2 uses Get-AzureADUser which should work for you. For more on this, see If you would like to continue using V1, you need to use my Connect-EXO script available here: - That script is in version 3 which might be causing the version number confusion as well. I had intended to build AAD V1 support into Connect-365 but that may no longer happen as it is seen as legacy.
  • Note: necessary change for German keyboards
    7 Posts | Last post May 09, 2016
    • You have to Change "Ctrl" to "Strg" on german Systems near line "467", otherwiese you get an error.
      Nethertheless, nice script!
    • Thanks for the info Rolf, I'll look into that.
    • Hi Rolf,
      I've been trying to re-produce your error, but it seems just setting my keyboard layout to German is not enough. Could you send me some screenshots or something?
    • Chris, setting the keyboard layout to de-DE locale is not sufficient. You have to change the primary language of your login. This way PowerShell will run in a de-DE context provide German output. Having this setting, PowerShell requires locale specific shortcut codes.
    • Using the Get-WinSystemLocale cmdlet (Import-Module international) you are able to fetch the locale setting and switch accordingly.
    • Hi Rolf and Thomas,
      I have implemented a workaround to the keyboard problem. I have only been able to perform limited testing and would greatly appreciate your feedback.
    • I have change in Line 29 & 30 STRG in Strg for german keyboard, then its works fine.
      Thanks for the script.
  • Really nice...
    2 Posts | Last post May 06, 2016
    • Is there any room to also include SPOService.  If possible Lync Session or ActiveDirectory
    • Thanks for the feedback. I am about to start working on a new version and can definitely look at including SPO. It's unlikely that I would ever include on-premises AD because the focus of the script is Office 365 services - but, never say never!
  • Could you add a choice to connect to the Compliance Center?
    3 Posts | Last post April 12, 2016
    • Great script and was wondering if you would add a choice to connect to the Compliance Center?  Thank you.
    • Yup sure thing - I'll look into that and let you know.
    • Version 3.1 now supports connecting to the Compliance Center. Thanks for the suggestion.
  • How do I close the session?
    2 Posts | Last post January 13, 2015
    • When I'm done, I usually run 'Remove-PSSession $Session'.  That doesn't seem to work here.  Is there some other way to close the session?
      Thanks for the script!
    • Hello,
      You can use the Get-PSSession cmdlet to show your active session and then use Remove-PSSession {ID} to remove the session. For example Remove-PSSession 1 or you could just type "Exit".
  • Accept "Enter"
    3 Posts | Last post January 13, 2015
    • Hi Chris,
      Nice script. I would suggest you make the credentials box accept "Enter" so that you do not need to click "OK".
    • Hi Henrik,
      Thanks for the feedback, but I'm not sure I understand what you mean. You should be able to use your tab key to move from the username field to the password field and then to the "OK" button at which point hitting enter should launch the script. If this is not your experience, check to make sure that you are using version 2.1.
    • Thinking about it, you are suggesting that hitting enter should launch the script regardless of which control is active at the time?