If you visit my Office 365 GitHub repository, you’ll find a whole of scripts there you can use for free. A subset of those scripts are designed to make connecting to the various Microsoft Cloud service easier. For example the script:
allows you to easily connect to Exchange Online using the version 2 module.
While all of this helps, it can still be a bit trickly for people to know what to run when to get connected. So, with that in mind I have created this script:
which when run by simply typing
in the PowerShell command line
will now pop up a dialog as shown above and allow you to select which service which wish to connect to.
Even better, you can also select multiple services in this same window. You simply use the CTRL and SHIFT keys to select multiple item, just as you do in any Windows desktop application (like Windows Explorer for files say).
After you have made your selection, those individual service connection scripts will be run.
Of course, the assumption is that you have all of my scripts (including the individual connection scripts) in the same directory. If not, then the connections will not be made. However, if you have ‘cloned’ what I have into a single location on your machine, then you should be all good.
I also created this short script:
which you can run at the PowerShell command prompt via:
to remove any currently loaded PowerShell sessions as well, quickly and easily.
Hopefully, this new ‘master connection’ script will make it easier for people to connect to the Microsoft Cloud services they need.
Make you you check back regularly to my Github repository for any updates and additions
4 thoughts on “An easier way to connect using PowerShell”
AWESOME MAN! TY
Let’s do IT: Better
Network Technology Partners
Office: (615) 819-0600
Fax: (615) 819-0601
LikeLiked by 1 person
Sorry, I am new to this. I click on the link above to go the github page for c.ps1. I copy the code (is there an easier way to download the file?). I paste into a text file called c.ps1.
I open PS as an admin, change to the directory of that file and type .\c.ps1 and press enter. I get a command line again (no errors)
Reading your script, I see this line and am not sure if it applies. But run it
set-executionpolicy -executionpolicy bypass -scope currentuser -force
Also, I get a command prompt again
Then run .\c.ps1. same command line returns with no error message / no window opens like in the images above.
You need to bring down ALL the files as c.ps1 requires many of these. You’ll find the option to download all files to a ZIP file on your system which you expand into a single directory. Powershell will give you no output unless there is an error. No output means the command worked without error.