Fix error “Import-Module : Could not load file or assembly 'System.Management.Automation, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.” with the usage of PnP commands

When I tried to use PnP PowerShell with just the basic connection, I've got errors immediately with Windows 11. Why it happened - I don't know, but I do how to fix it.

The solution consists of 4 steps:

1. Uninstall all versions PnP PowerShell

Uninstall-Module PnP.PowerShell -AllVersions

2. Set Tls12 protocol

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

3. Install Nuget

Install-PackageProvider -Name nuget -MinimumVersion -force

The result is smth like this:

Name                           Version          Source           Summary
----                           -------          ------           -------
nuget                        https://onege... NuGet provider for the OneGet meta-package manager

4. Install PnP.PowerShell

Install-Module -Name "PnP.PowerShell" -RequiredVersion 1.12.0 -Force -AllowClobber

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment Notes of web-specialist
Since 2009