Added fix for PSModulePath resetting in Invoke-DscClassBasedResource

This commit is contained in:
anmenaga
2020-10-01 15:55:28 -07:00
parent 9ddb7e2305
commit aa4652ce28
@@ -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