mirror of
https://github.com/PowerShell/PSDesiredStateConfiguration
synced 2026-06-21 13:45:25 +00:00
Added fix for PSModulePath resetting in Invoke-DscClassBasedResource
This commit is contained in:
@@ -4908,6 +4908,8 @@ function Invoke-DscClassBasedResource
|
||||
|
||||
Write-Debug "Importing $path ..."
|
||||
$iss = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault2()
|
||||
# next line prevents PSModulePath from being reset to default
|
||||
$iss.EnvironmentVariables.Add([System.Management.Automation.Runspaces.SessionStateVariableEntry]::new("PSModulePath", $env:PSModulePath, $null))
|
||||
$powershell = [PowerShell]::Create($iss)
|
||||
$script = @"
|
||||
using module $path
|
||||
|
||||
Reference in New Issue
Block a user