The 'Add-PnPStoredCredential' command was found in the module 'PnP.PowerShell', but the module could not be loaded #2964
Replies: 2 comments 1 reply
-
Same error, magically appears over the week-end after having worked for months without change in the script -- currently looking for an explanation |
Beta Was this translation helpful? Give feedback.
0 replies
-
Solution in edited Question section. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Add-PnPStoredCredential : The 'Add-PnPStoredCredential' command was found in the module 'PnP.PowerShell', but the
module could not be loaded. For more information, run 'Import-Module PnP.PowerShell'.
We did not have this error by using 1.12.0 pnp module but now we get it with 2.1.1. Does this mean that we need to run 'Import-Module PnP.PowerShell' every time in the future after install-module PnP.PowerShell?
OS: Windows Server 2022 latest
Code:
Install-Module -Name "PnP.Powershell" -Force
Update:
Adding 'Import-Module PnP.PowerShell' after 'Install-Module -Name "PnP.Powershell" -Force' gave us the following error:
Import-Module : 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
Solution:
It turns out that PnP Module 2.1.1 does not suppport powershell 5.x anymore. Using Powershell 7.x fixed our problem.
Beta Was this translation helpful? Give feedback.
All reactions