Skip to content

Commit

Permalink
#175 Save and restore $env:PSModulePath until we find why it's being …
Browse files Browse the repository at this point in the history
…clobbered on PS Core
  • Loading branch information
codykonior committed Feb 24, 2018
1 parent 7be912f commit 85842f7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions PoshRSJob/Public/Start-RSJob.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ Function Start-RSJob {
Else {
Write-Verbose "Creating new runspacepool <$Batch>"
$RunspacePoolID = $Batch
$PSModulePath = $env:PSModulePath
$RunspacePool = [runspacefactory]::CreateRunspacePool($InitialSessionState)
If ($RunspacePool.psobject.Properties["ApartmentState"]) {
#ApartmentState doesn't exist in Nano Server
Expand All @@ -530,6 +531,7 @@ Function Start-RSJob {

#[System.Threading.Monitor]::Enter($PoshRS_RunspacePools.syncroot) #Temp add
[void]$PoshRS_RunspacePools.Add($RSPObject)
$env:PSModulePath = $PSModulePath
}
}
finally {
Expand Down

0 comments on commit 85842f7

Please sign in to comment.