Connect to PnP PowerShell script

The latest pnp.powershell module (V2.X and above) now won’t work with PowerShell v5. Thus, I have updated my PnP connection script:

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

to accommodate this.

Thus, if you attempt to run this script in PowerShell version 5 with the latest pnp.powershell module you will typically see:

image

and the error is:

Could not load file or assembly ‘System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

However, when you run the script in PowerShell V7 you’ll see:

image

that the connection is successful.

I have also taken the opportunity to remove the dependency in the script as well on the now depreciated module MSONLINE and replaced it the Microsoft.Graph module.

This kind of signals the beginning of the end for modern cloud modules in PowerShell 5. However, some still require PowerShell 5 but I expect that to change.

In summary, the latest pnp.powershell modules require PowerShell version 7 and I have updated my connection script to accommodate this.

CIAOPS Need to Know Microsoft 365 Webinar – July

Join me for the free monthly CIAOPS Need to Know webinar. Along with all the Microsoft Cloud news we’ll be taking a look at Microsoft Flow.

Shortly after registering you should receive an automated email from Microsoft Teams confirming your registration, including all the event details as well as a calendar invite.

You can register for the regular monthly webinar here:

July Webinar Registrations

(If you are having issues with the above link copy and paste – https://bit.ly/n2k2307

The details are:

CIAOPS Need to Know Webinar – June 2023
Friday 30th of June 2023
11.00am – 12.00am Sydney Time

All sessions are recorded and posted to the CIAOPS Academy.

The CIAOPS Need to Know Webinars are free to attend but if you want to receive the recording of the session you need to sign up as a CIAOPS patron which you can do here:

http://www.ciaopspatron.com

or purchase them individually at:

http://www.ciaopsacademy.com/

Also feel free at any stage to email me directly via director@ciaops.com with your webinar topic suggestions.

I’d also appreciate you sharing information about this webinar with anyone you feel may benefit from the session and I look forward to seeing you there.