Skip to content

Commit cd1f1c2

Browse files
committed
Fix issue with loading Windows resources in PSDesiredStateConfiguration module
1 parent a735c6d commit cd1f1c2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

powershell-adapter/psDscAdapter/psDscAdapter.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ function Invoke-DscCacheRefresh {
5353
$Modules += Get-Module -Name $m -ListAvailable
5454
}
5555
}
56-
elseif ('PSDesiredStateConfiguration' -eq $module) {
56+
elseif ('PSDesiredStateConfiguration' -eq $module -and $PSVersionTable.PSVersion.Major -le 5 ) {
57+
# the resources in Windows should only load in Windows PowerShell
5758
# workaround: the binary modules don't have a module name, so we have to special case File and SignatureValidation resources that ship in Windows
5859
$DscResources = Get-DscResource | Where-Object { $_.modulename -eq 'PSDesiredStateConfiguration' -or ( $_.modulename -eq $null -and $_.parentpath -like "$env:windir\System32\Configuration\*" ) }
5960
}

0 commit comments

Comments
 (0)