Skip to content

Commit 0df185a

Browse files
authored
Update psDscAdapter.psm1 for multi methods on export
1 parent 098b3c1 commit 0df185a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

powershell-adapter/psDscAdapter/psDscAdapter.psm1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,16 @@ function Invoke-DscOperation {
484484
$addToActualState.properties = [psobject]@{'InDesiredState'=$Result}
485485
}
486486
'Export' {
487-
$t = $dscResourceInstance.GetType()
488-
$method = $t.GetMethod('Export')
487+
$methods = $t.GetMethods() | Where-Object { $_.Name -eq 'Export' }
488+
$method = foreach ($m in $methods)
489+
{
490+
if ($m.GetParameters().Count -eq 0)
491+
{
492+
$m
493+
break
494+
}
495+
}
496+
489497
if ($null -eq $method) {
490498
"Export method not implemented by resource '$($DesiredState.Type)'" | Write-DscTrace -Operation Error
491499
exit 1

0 commit comments

Comments
 (0)