Skip to content

System32 module path is added repeatedly in subprocesses #7327

Closed

Description

@rjmholt

Steps to reproduce

> $env:PSModulePath -split ';'
C:\Users\roholt\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\6-preview\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

> & "$PSHOME\pwsh.exe"
> $env:PSModulePath -split ';'
C:\Users\roholt\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\6-preview\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

> & "PSHOME\pwsh.exe"
> $env:PSModulePath -split ';'
C:\Users\roholt\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\6-preview\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

> exit
> $env:PSModulePath -split ';'
C:\Users\roholt\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\6-preview\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

> exit
> $env:PSModulePath -split ';'
C:\Users\roholt\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\6-preview\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

Expected behavior

System32 module paths don't build up.

Actual behavior

System32 module paths keep getting tacked onto the end of the the PSModulePath.

Pros:

  • You always know how many PowerShells deep you are

Cons:

  • This is broken

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.4
PSEdition                      Core
GitCommitId                    6.1.0-preview.4
OS                             Microsoft Windows 10.0.18200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. rjmholt commented on Jul 20, 2018

    @rjmholt
    CollaboratorAuthor

    Related to #7324

  2. added
    Issue-Bug
    on Jul 21, 2018
  3. added
    WG-Cmdlets
    and removed on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugResolution-FixedWG-Cmdlets

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions