@@ -38,24 +38,24 @@ function Invoke-DscCacheRefresh {
38
38
)
39
39
40
40
# cache the results of Get-DscResource
41
- [dscResourceCache []]$dscResourceCache = @ ()
41
+ [dscResourceCache []]$dscResourceCache = [ System.Collections.Generic.List [ Object ]]::new ()
42
42
43
43
# improve by performance by having the option to only get details for named modules
44
44
# workaround for File and SignatureValidation resources that ship in Windows
45
45
if ($null -ne $module -and ' PSDesiredStateConfiguration' -ne $module ) {
46
46
if ($module.gettype ().name -eq ' string' ) {
47
47
$module = @ ($module )
48
48
}
49
- $DscResources = @ ()
50
- $Modules = @ ()
49
+ $DscResources = [ System.Collections.Generic.List [ Object ]]::new ()
50
+ $Modules = [ System.Collections.Generic.List [ Object ]]::new ()
51
51
foreach ($m in $module ) {
52
52
$DscResources += Get-DscResource - Module $m
53
53
$Modules += Get-Module - Name $m - ListAvailable
54
54
}
55
55
}
56
56
elseif (' PSDesiredStateConfiguration' -eq $module ) {
57
57
# workaround: the binary modules don't have a module name, so we have to special case File and SignatureValidation resources that ship in Windows
58
- $DscResources = Get-DscResource | Where-Object { $_.modulename -eq $ null -and $_.parentpath -like " $env: windir \System32\Configuration\*" }
58
+ $DscResources = Get-DscResource | Where-Object { $_.modulename -eq ' PSDesiredStateConfiguration ' -or ( $_ .modulename -eq $ null -and $_.parentpath -like " $env: windir \System32\Configuration\*" ) }
59
59
}
60
60
else {
61
61
# if no module is specified, get all resources
@@ -95,6 +95,7 @@ function Invoke-DscCacheRefresh {
95
95
$DscResourceInfo .$ ($_.Name ) = ' '
96
96
}
97
97
}
98
+
98
99
if ($dscResource.ModuleName ) {
99
100
$moduleName = $dscResource.ModuleName
100
101
}
@@ -108,7 +109,7 @@ function Invoke-DscCacheRefresh {
108
109
$DscResourceInfo.ImplementationDetail = ' Binary'
109
110
}
110
111
}
111
- elseif ($dscResource.ParentPath ) {
112
+ elseif ($binaryBuiltInModulePaths -notcontains $dscResource .ParentPath -and $null -ne $ dscResource.ParentPath ) {
112
113
# workaround: populate module name from parent path that is three levels up
113
114
$moduleName = Split-Path $dscResource.ParentPath | Split-Path | Split-Path - Leaf
114
115
$DscResourceInfo.Module = $moduleName
0 commit comments