@@ -460,6 +460,8 @@ function Invoke-DscOperation {
460
460
$resource = GetTypeInstanceFromModule - modulename $cachedDscResourceInfo.ModuleName - classname $cachedDscResourceInfo.Name
461
461
$dscResourceInstance = $resource ::New()
462
462
463
+ $ValidProperties = $cachedDscResourceInfo.Properties.Name
464
+
463
465
if ($DesiredState.properties ) {
464
466
# set each property of $dscResourceInstance to the value of the property in the $desiredState INPUT object
465
467
$DesiredState.properties.psobject.properties | ForEach-Object - Process {
@@ -469,14 +471,18 @@ function Invoke-DscOperation {
469
471
470
472
switch ($Operation ) {
471
473
' Get' {
472
- $Result = $dscResourceInstance.Get ()
474
+ $Result = @ {}
475
+ $raw_obj = $dscResourceInstance.Get ()
476
+ $ValidProperties | % { $Result [$_ ] = $raw_obj [$_ ] }
473
477
$addToActualState.properties = $Result
474
478
}
475
479
' Set' {
476
480
$dscResourceInstance.Set ()
477
481
}
478
482
' Test' {
479
- $Result = $dscResourceInstance.Test ()
483
+ $Result = @ {}
484
+ $raw_obj = $dscResourceInstance.Test ()
485
+ $ValidProperties | % { $Result [$_ ] = $raw_obj [$_ ] }
480
486
$addToActualState.properties = [psobject ]@ {' InDesiredState' = $Result }
481
487
}
482
488
' Export' {
@@ -486,7 +492,13 @@ function Invoke-DscOperation {
486
492
" Export method not implemented by resource '$ ( $DesiredState.Type ) '" | Write-DscTrace - Operation Error
487
493
exit 1
488
494
}
489
- $resultArray = $method.Invoke ($null , $null )
495
+ $resultArray = @ ()
496
+ $raw_obj_array = $method.Invoke ($null , $null )
497
+ foreach ($raw_obj in $raw_obj_array ) {
498
+ $Result_obj = @ {}
499
+ $ValidProperties | % { $Result_obj [$_ ] = $raw_obj [$_ ] }
500
+ $resultArray += $Result_obj
501
+ }
490
502
$addToActualState = $resultArray
491
503
}
492
504
}
0 commit comments