-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
This is a dupe of #12997 which was closed.
- Set up invocation of powershell.exe in some sort of non-PS tool.
- Example below of a bat with New-Guid (different between PS versions)
- Invoke the bat from pwsh.
example.bat
echo %psmodulepath%
powershell.exe "$env:PSModulePath -split ';' | Select-String 'PowerShell'; New-Guid"
Expected behavior
Powershell.exe instance does not contain `C:\Program Files\PowerShell\7`Actual behavior
Powershell.exe still has PS7 values in PSModulePath and New-Guid throws an error. This is in a pwsh.exe window.
PS C:\Users\gsanchez\temp> .\example.bat
C:\Users\gsanchez\temp>echo C:\Users\gsanchez\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\Sequencer\AppvPkgConverter;C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\Sequencer\AppvSequencer;C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\
C:\Users\gsanchez\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\Sequencer\AppvPkgConverter;C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\Sequencer\AppvSequencer;C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\
C:\Users\gsanchez\temp>powershell.exe "$env:PSModulePath -split ';' | Select-String 'PowerShell'; New-Guid"
C:\Users\gsanchez\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\7\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
New-Guid : The term 'New-Guid' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:60
+ $env:PSModulePath -split ';' | Select-String 'PowerShell'; New-Guid
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-Guid:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundExceptionError details
New-Guid : The term 'New-Guid' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:52
+ $env:Path -split ';' | Select-String 'PowerShell'; New-Guid
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-Guid:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundExceptionEnvironment data
Name Value
---- -----
PSVersion 7.3.10
PSEdition Core
GitCommitId 7.3.10
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.