error 0x80070002 when launching `powershell.exe -NoExit -Command "Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;"' #11573

Closed
opened 2026-01-31 02:51:29 +00:00 by claunia · 15 comments
Owner

Originally created by @nicholasp on GitHub (Nov 25, 2020).

Environment

Windows build number: 10.0.19042.0
Windows Terminal version (if applicable): 1.5.3142.0 (preview), 1.4.3243.0 (both tested)

Steps to reproduce

The settings is here:

{
                "guid": "{01cf68bc-26a3-4870-b6c7-c98970656516}",
                "name": "SharePoint PnP Online",
                "tabTitle": "SharePoint PnP",
                "hidden": false,
                "commandline": "powershell.exe -NoExit -Command \"Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;\"",
}

If I run the command from a cmd or powershell it works. But when I open from tab (+) I get this error (issue title).

I checked all Issues here and the solution with path doesn't work. The path is correct. (v1.0) also as I said it works from another opened instance.

$env:Path -split ';' | Select-String -Pattern "^*ower*"
---
....
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files\PowerShell\7\
C:\Windows\System32\WindowsPowerShell\v1.0
....

The exact same settings works from my laptop but doesn't work from my work pc. Can I somehow get a more detailed error message? I also checked Malware/Antivirus logs didn't found something there.
If I change the settings to: "commandline": "powershell.exe" then it opens powershell. Something with parameters for this pc?

Expected behavior

Windows PowerShell is open with Module

Actual behavior

Error message:
error 0x80070002 when launching `powershell.exe -NoExit -Command "Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;"'

Originally created by @nicholasp on GitHub (Nov 25, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.19042.0 Windows Terminal version (if applicable): 1.5.3142.0 (preview), 1.4.3243.0 (both tested) ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> The settings is here: ```json { "guid": "{01cf68bc-26a3-4870-b6c7-c98970656516}", "name": "SharePoint PnP Online", "tabTitle": "SharePoint PnP", "hidden": false, "commandline": "powershell.exe -NoExit -Command \"Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;\"", } ``` If I run the command from a cmd or powershell it works. But when I open from tab (+) I get this error (issue title). I checked all Issues here and the solution with path doesn't work. The path is correct. (v1.0) also as I said it works from another opened instance. ```PowerShell $env:Path -split ';' | Select-String -Pattern "^*ower*" --- .... C:\WINDOWS\System32\WindowsPowerShell\v1.0\ C:\Program Files\PowerShell\7\ C:\Windows\System32\WindowsPowerShell\v1.0 .... ``` The exact same settings works from my laptop but doesn't work from my work pc. Can I somehow get a more detailed error message? I also checked Malware/Antivirus logs didn't found something there. If I change the settings to: "commandline": "powershell.exe" then it opens powershell. Something with parameters for this pc? # Expected behavior Windows PowerShell is open with Module # Actual behavior Error message: error 0x80070002 when launching `powershell.exe -NoExit -Command "Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;"'
Author
Owner

@DHowett commented on GitHub (Nov 25, 2020):

That is quite unusual. If you specify the full path to PowerShell, C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe, does it work?

@DHowett commented on GitHub (Nov 25, 2020): That _is_ quite unusual. If you specify the full path to PowerShell, `C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`, does it work?
Author
Owner

@ghost commented on GitHub (Nov 29, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Nov 29, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@nicholasp commented on GitHub (Nov 29, 2020):

Still doesn't. If I have parameters there, I am getting the error

[error 0x80070002 when launching `C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoExit -Command "Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;"']

I also tried my linux ssh setting and I am getting the same error with parameters

[error 0x80070002 when launching `wsl -d Ubuntu-20.04 ssh user@XX.XX.XX.XX']

If I type it to an opened powershell it works fine... Is there any policy that maybe restrict that?? Even though the equivalent command at conemu working fine at this pc

@nicholasp commented on GitHub (Nov 29, 2020): Still doesn't. If I have parameters there, I am getting the error ``` [error 0x80070002 when launching `C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoExit -Command "Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;"'] ``` I also tried my linux ssh setting and I am getting the same error with parameters ``` [error 0x80070002 when launching `wsl -d Ubuntu-20.04 ssh user@XX.XX.XX.XX'] ``` If I type it to an opened powershell it works fine... Is there any policy that maybe restrict that?? Even though the equivalent command at conemu working fine at this pc
Author
Owner

@nicholasp commented on GitHub (Dec 11, 2020):

@DHowett Is there any way to debug this?

@nicholasp commented on GitHub (Dec 11, 2020): @DHowett Is there any way to debug this?
Author
Owner

@DHowett commented on GitHub (Dec 11, 2020):

This is curious. Probably I've been barking up the wrong tree . . .

I know Terminal's been installed by the app packager, but can you confirm that OpenConsole.exe exists next to it?

Run this from a Windows PowerShell window.

gi ((get-appxpackage microsoft.windowsterminalpreview).InstallLocation +"\OpenConsole.exe")
@DHowett commented on GitHub (Dec 11, 2020): This is curious. Probably I've been barking up the wrong tree . . . I know Terminal's been installed by the app packager, but can you confirm that `OpenConsole.exe` exists next to it? Run this from a Windows PowerShell window. ```powershell gi ((get-appxpackage microsoft.windowsterminalpreview).InstallLocation +"\OpenConsole.exe") ```
Author
Owner

@DHowett commented on GitHub (Dec 11, 2020):

The avenue I'm investigating right now is not that powershell won't launch, but that the entire pty host won't launch. It's a version of the windows console host (conhost.exe) built out of this repository and shipped inside Terminal.

@DHowett commented on GitHub (Dec 11, 2020): The avenue I'm investigating right now is not that powershell won't launch, but that _the entire pty host_ won't launch. It's a version of the windows console host (conhost.exe) built out of this repository and shipped inside Terminal.
Author
Owner

@nicholasp commented on GitHub (Dec 12, 2020):

It exists:

Directory: C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.5.3242.0_x64__8wekyb3d8bbwe


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        24/11/2020     14:38        1079296 OpenConsole.exe
@nicholasp commented on GitHub (Dec 12, 2020): It exists: ```powershell Directory: C:\Program Files\WindowsApps\Microsoft.WindowsTerminalPreview_1.5.3242.0_x64__8wekyb3d8bbwe Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 24/11/2020 14:38 1079296 OpenConsole.exe ```
Author
Owner

@DHowett commented on GitHub (Jul 2, 2021):

There have been a couple releases since this issue first cropped up... and we haven't seen other reports of it. Does it still happen for you?

@DHowett commented on GitHub (Jul 2, 2021): There have been a couple releases since this issue first cropped up... and we haven't seen other reports of it. Does it still happen for you?
Author
Owner

@ghost commented on GitHub (Jul 6, 2021):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jul 6, 2021): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@nicholasp commented on GitHub (Jul 8, 2021):

Hello DHowett,

Thanks for replying, the problem still exists

Windows Terminal Preview
Version: 1.9.1523.0

examples

[error 0x80070002 when launching `wsl -d Ubuntu-20.04 ssh user@10.1.1.10']

[error 0x80070002 when launching `C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoExit -Command "Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;"']
@nicholasp commented on GitHub (Jul 8, 2021): Hello DHowett, Thanks for replying, the problem still exists ``` Windows Terminal Preview Version: 1.9.1523.0 ``` examples ``` [error 0x80070002 when launching `wsl -d Ubuntu-20.04 ssh user@10.1.1.10'] [error 0x80070002 when launching `C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoExit -Command "Import-Module SharePointPnPPowerShellOnline -DisableNameChecking;"'] ```
Author
Owner

@DHowett commented on GitHub (Jul 8, 2021):

This is really interesting!

Would you mind installing Process Monitor and setting it up as follows?

image

Make sure you press Add.

image

Then, let it run. Try to open both PowerShell and WSL.

Afterwards, save the trace in PML format and upload it somewhere or e-mail it to me?

@DHowett commented on GitHub (Jul 8, 2021): This is really interesting! Would you mind installing [Process Monitor](https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) and setting it up as follows? ![image](https://user-images.githubusercontent.com/189190/124960677-2cabed80-dfe2-11eb-9779-c37877ffb5de.png) Make sure you press Add. ![image](https://user-images.githubusercontent.com/189190/124960711-36cdec00-dfe2-11eb-9649-052e64d007dc.png) Then, let it run. Try to open both PowerShell and WSL. Afterwards, save the trace in PML format and upload it somewhere or e-mail it to me?
Author
Owner

@ghost commented on GitHub (Jul 12, 2021):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jul 12, 2021): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@nicholasp commented on GitHub (Jul 13, 2021):

I just send the mail with logfile

@nicholasp commented on GitHub (Jul 13, 2021): I just send the mail with logfile
Author
Owner

@DHowett commented on GitHub (Jul 13, 2021):

Thanks! It's not quite arrived in my inbox yet, so I'm going to mark this up for "Needs-Feedback" until it shows up.

@DHowett commented on GitHub (Jul 13, 2021): Thanks! It's not quite arrived in my inbox yet, so I'm going to mark this up for "Needs-Feedback" until it shows up.
Author
Owner

@ghost commented on GitHub (Sep 13, 2022):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Sep 13, 2022): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11573