An easier way to connect using PowerShell

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:

https://github.com/directorcia/Office365/blob/master/o365-connect-exov2.ps1

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:

https://github.com/directorcia/Office365/blob/master/c.ps1

which when run by simply typing

.\c.ps1

in the PowerShell command line

image

will now pop up a dialog as shown above and allow you to select which service which wish to connect to.

image

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:

https://github.com/directorcia/Office365/blob/master/r.ps1

which you can run at the PowerShell command prompt via:

.\r.ps1

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

  1. 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.

    User error?

    Like

    1. 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.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s