I was recently working on a client project and came across an issue. I was trying to run a script that not only created Teams sites but also created Tabs within the teams. The script required the use of PnP PowerShell v2.1, which requires PowerShell 7. I needed to connect to the SharePoint Online Management Shell and just could not do it. I’d tried importing the Management Shell and un-installing (as well as other techniques) to try and figure out why I kept getting an error to the effect of

Import-Module : Could not load type ‘Microsoft.SharePoint.Administration.DesignPackageType’ from assembly ‘Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken……

The fix that worked for me was adding -UseWindowsPowerShell so that the command was Import-Module microsoft.online.sharepoint.powershell -UseWindowsPowerShell .

Hopefully this saves time for anyone needing to connect to SharePoint via PowerShell 7!

About the author