I am trying to run this command inside Windows PowerShell 7 :
Connect-SPOService -Url https://***-admin.sharepoint.com
But I got this error:
Connect-SPOService: Could not load type 'Microsoft.SharePoint.Client.SharePointOnlineCredentials' from assembly 'Microsoft.SharePoint.Client.Runtime, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.
Also when I tried to uninstall the module and reinstall it I got these results:
PS C:\Users\mohan> Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell
Uninstall-Package: No match was found for the specified search criteria and module names 'Microsoft.Online.SharePoint.PowerShell'.
PS C:\Users\mohan> Install-Module -Name Microsoft.Online.SharePoint.PowerShell
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
WARNING: Version '16.0.23311.12000' of module 'Microsoft.Online.SharePoint.PowerShell' is already installed at 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Online.SharePoint.PowerShell\16.0.23311.12000'. To install version '16.0.23508.12000', run Install-Module and add the -Force parameter, this command will install version '16.0.23508.12000' side-by-side with version '16.0.23311.12000'.
PS C:\Users\mohan> Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version
Name Version
---- -------
Microsoft.Online.SharePoint.PowerShell 16.0.23311.12000
Microsoft.Online.SharePoint.PowerShell 16.0.22601.12000
Microsoft.Online.SharePoint.PowerShell 16.0.22315.12000
So how can I run Connect-PnPService
inside Windows PowerShell 7?
Connect-PnPService
. You haveConnect-SPOService
in SPO PowerShell and you have to run it via SharePoint Online Management Shell onlyConnect-SPOService
and notConnect-PnPService
.