New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import-module "PnP.PowerShell" not working #2969
Comments
same error on windows server 2016 |
@AlyaKoni ISE and PS 5.x is not supported anymore - installed PS 7.3 and using VisualStudio Code as Editor worked fine. |
As @SnappyFPV mentioned, you need to install PS 7.2 or later versions. This 2.1.1 release has dropped support for PS 5.1 and ISE. If you want to keep using PS 5.1 or ISE, you can use the 1.12.0 version. |
Same error here. PS 7.3 and using VisualStudio Code as Editor also smae error outside of vscode. I've also tried the nightly build |
@AlyaKoni @LycheeYum - Please make sure your PowerShell session is running PS7 regardless of using VSCode or not (VSCode can also run PS5). Works fine on our end with VSCode, Terminal or even on MacOS. |
In PS7 the import is working, may now I get if I try to connect:
|
Hi there, I have installed the latest version of PnP PowerShell 2.3.0 and when I Import-Module PnP.PowerShell with windows PowerShell 7.4 , it's importing fine but when I use windows PowerShell ISE editor and importing Import-Module PnP.PowerShell is throwing following error. I want to debug the script using ISE but unable to do it. I am in windows 11 a surface pro. Import-Module : Could not load file or assembly 'System.Management.Automation, Version=7.2.0.0, Culture=neutral,
|
Hi there, I have installed the latest version of PnP PowerShell 2.3.0 and when I Import-Module PnP.PowerShell with windows PowerShell 7.4 , it's importing fine but when I use windows PowerShell ISE editor and importing Import-Module PnP.PowerShell is throwing following error. I want to debug the script using ISE but unable to do it. I am in windows 11 win a surface pro. Import-Module : Could not load file or assembly 'System.Management.Automation, Version=7.2.0.0, Culture=neutral,
|
ISE and PowerShell 5 no longer works for PnP. You have to use Visual Studio Code with PowerShell 7. |
Thank you Konrad,
Can you please provide the guidance of debugging PS Script using VS code?
…________________________________
From: Konrad Brunner ***@***.***>
Sent: Wednesday, December 13, 2023 11:53 PM
To: pnp/powershell ***@***.***>
Cc: Doorga Shukla ***@***.***>; Comment ***@***.***>
Subject: Re: [pnp/powershell] Import-module "PnP.PowerShell" not working (Issue #2969)
ISE and PowerShell 5 no longer works for PnP. You have to use Visual Studio Code with PowerShell 7.
—
Reply to this email directly, view it on GitHub<#2969 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BEVKRQMO2TBQGCCLQRVS5GTYJKH53AVCNFSM6AAAAAAWR5Q6YSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJVGE4DOMRRGE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
You need to install the PowerShell extension in Code. Then just press the play button. |
I've installed Powershell 7.x and Visual Studio Code. I realize based on what is being told here that ISE is no longer supported for PnP 2.3, but i'm also seeing that i'm not able to execute Connect-PnPOnline using Visual Studio Code, after installing the PowerShell extension. So VS Code will not connect to Sharepoint via Connect-PnPonline either? Am I missing a step? Thanks |
Make sure you use PowerShell 7 in your Terminal in Code. Check $PSVersionTable. What kind of error do you get? |
Be carefull with powershell versions. I stopped using powershell because some modules do only work with powershell 7 and some doesn't so you end up with a hell of different versions and which does support which. Programs which do start in powershell but as soon as you want to have a debugger so you start visual code it doesn't work anymore because of different powershell versions. |
In general, all PowerShell modules work in PowerShell 7, but some have to be loaded with special parameters in order to work in PowerShell 7. However, some modules cannot work with other modules. In this case, you will always need a new PowerShell session. Have a look at my method Install-ModuleIfNotInstalled. This can give you some help when loading modules in PowerShell 7. https://github.com/AlyaKoni/ALYADO-ADM-Public/blob/master/01_ConfigureEnv.ps1 |
$PSVersionTable returns PSversion value of 5.1.22000.2600 After installing the PowerShell extension, I go into Settings | PowerShell Default Version and insert the value "C:\program files\PowerShell\7\7\pwsh.exe, but am informed via log errors that the location could not be found, and get message "Instead using first available installation at c:\windows\system32\windowsPowershell\v1.0\powershell.exe". The pwsh.exe path for PS7 is correct and in existence in my local folder path. |
Sure a double 7 in the path? "C:\program files\PowerShell\7\7\pwsh.exe" |
Yes, i found it odd too. At the first \7 root, there is another '7' folder, but at the second \7 root I see all the folders and pwsh.exe. Running it opens up a PS 7.4.0 session screen. Path written is "c:\program files\powershell\7\7> |
Reporting an Issue
import-module "PnP.PowerShell" not working
Expected behavior
PnP PowerShell should be loaded into actual session
Actual behavior
Not able to load PnP PowerShell into actual session. import-module "PnP.PowerShell" gives following error:
Import-Module : Die Datei oder Assembly "System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden. In Zeile:1 Zeichen:1 Import-Module "Pnp.PowerShell" CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
Steps to reproduce behavior
Install-Module "PnP.PowerShell" -Scope CurrentUser
Import-Module "PnP.PowerShell"
What is the version of the Cmdlet module you are running?
2.1.0 or 2.1.1, both have the issue
With 1.12.0 everything works fine
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: