Skip to content
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 PoshRSJob overwrites $env:PSModulePath on PS Core 6.0.1 due to Add-WindowsPSModulePath incompatibility #175

Open
codykonior opened this issue Feb 24, 2018 · 2 comments

Comments

@codykonior
Copy link
Contributor

codykonior commented Feb 24, 2018

Do you want to request a feature or report a bug?
Incompatibility.

What is the current behavior?
PowerShell Core 6 doesn't include the standard PSModulePath, instead it can be added using the WindowsPSModulePath module and Add-WindowsPSModulePath.

If you do this though and Import-Module PoshRSJob then the path gets lost. This doesn't appear to happen with other modules I tested.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

pwsh
Add-WindowsPSModulePath
Import-Module PoshRSJob
Import-Module PoshRSJob

What is the expected behavior?
The first import works (assuming it's on your path). The second fails because it won't be on the path any longer.

Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?

Name                           Value
----                           -----
PSVersion                      6.0.1
PSEdition                      Core
GitCommitId                    v6.0.1
OS                             Microsoft Windows 6.3.9600
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@codykonior
Copy link
Contributor Author

codykonior commented Feb 24, 2018

It's caused by PoshRSJob.psm1

$PoshRS_jobCleanup.Runspace =[runspacefactory]::CreateRunspace()
$PoshRS_jobCleanup.Runspace.Open()

If you uncomment those (which obviously breaks everything) it will load without overwriting the module path. But only if you've modified it using Add-WindowsPSModulePath. If you modified it manually then the path isn't lost.

I'm not sure why the two are different though.

@codykonior codykonior changed the title Import-Module PoshRSJob overwrites $env:PSModulePath on PS Core 6.0.1 Import-Module PoshRSJob overwrites $env:PSModulePath on PS Core 6.0.1 due to Add-WindowsPSModulePath incompatibility Feb 24, 2018
codykonior added a commit to codykonior/PoshRSJob that referenced this issue Feb 24, 2018
codykonior added a commit to codykonior/PoshRSJob that referenced this issue Feb 24, 2018
@proxb proxb reopened this Feb 24, 2018
@proxb
Copy link
Owner

proxb commented Feb 24, 2018

Didn't mean to auto-close this. Definitely want to keep it around to find the root cause of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants