How about a script that will help you to connect to Exchange online aka EXO. It is not the copy n paste from TechNet. It checks for different conditions, like it checks whether you are already connected to EXO or not. Based on that you can setup new connections to Exchange Online. Read it and rate it. Don’t forget to rename the extension of the file to ps1 before you run it. This piece of code requires POwerShell version 3.0 or higher.