You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
powershell.exe still receives PSModulePath for pwsh when called indirectly #12997
I know why this is happening given how #11057 was implemented. Is there any sort of workaround, other than explicitly resetting the PSModulePath in the Windows Powershell script?
Steps to reproduce
Set up invocation of powershell.exe in some sort of non-PS tool. In my case, a post-action on a dotnet new template.
Nick Wesselman (@nickwesselman) When you directly invoke powershell from pwsh, PS 7 has special logic to detect that you are about to launch Windows PowerShell and thus it strips off the PS 7 specific module paths from the environment variable when starting the powershell process. But in your case, it's not PS 7 that starts powershell, but dotnet.exe. dontet.exe inherits the environment variables and so did powershell when it starts.
We can potentially always strip off the PS 7 specific module paths when starting a native executable, but it may cause a similar issue where people expect the PS 7 module paths to be there but not ... /cc Steve Lee (@SteveL-MSFT)Joey Aiello (@joeyaiello)
I still don't understand why we need to use this variable as an external exclusive storage. Ideally, we would always use it as a source for additional custom paths and always add service paths internally. This approach seems to solve all problems of side-by-side coexistence in any combination of versions and in any nesting.
Finally found this issue! So I've seen this with Choco.exe, and with some internal tools at work. I could try to manually set the module path, but this would mean patching up a ton of random tools. Not to mention having to warn folks of this edge case.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
Activity
daxian-dbw commentedon Jul 10, 2020
Nick Wesselman (@nickwesselman) When you directly invoke
powershellfrompwsh, PS 7 has special logic to detect that you are about to launch Windows PowerShell and thus it strips off the PS 7 specific module paths from the environment variable when starting thepowershellprocess. But in your case, it's not PS 7 that startspowershell, butdotnet.exe.dontet.exeinherits the environment variables and so didpowershellwhen it starts.We can potentially always strip off the PS 7 specific module paths when starting a native executable, but it may cause a similar issue where people expect the PS 7 module paths to be there but not ... /cc Steve Lee (@SteveL-MSFT) Joey Aiello (@joeyaiello)
iSazonov commentedon Jan 16, 2021
I still don't understand why we need to use this variable as an external exclusive storage. Ideally, we would always use it as a source for additional custom paths and always add service paths internally. This approach seems to solve all problems of side-by-side coexistence in any combination of versions and in any nesting.
HeyItsGilbert commentedon Mar 29, 2023
Finally found this issue! So I've seen this with Choco.exe, and with some internal tools at work. I could try to manually set the module path, but this would mean patching up a ton of random tools. Not to mention having to warn folks of this edge case.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.