@@ -364,16 +364,16 @@ function Invoke-DscOperation {
364364 # morph the INPUT object into a hashtable named "property" for the cmdlet Invoke-DscResource
365365 $DesiredState.properties.psobject.properties | ForEach-Object - Begin { $property = @ {} } - Process {
366366 if ($_.Value -is [System.Management.Automation.PSCustomObject ]) {
367- $validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Value
367+ $validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Name
368368 if ($validateProperty.PropertyType -eq ' PSCredential' ) {
369369 if (-not $_.Value.Username -and -not $_.Value.Password ) {
370370 " Credential property '$ ( $_.Name ) ' requires both username and password input object" | Write-DscTrace - Operation Error
371371 exit 1
372372 }
373- $dscResourceInstance .$ ($_.Name ) = [System.Management.Automation.PSCredential ]::new($_.Value.Username , (ConvertTo-SecureString - AsPlainText $_.Value.Password - Force))
373+ $property .$ ($_.Name ) = [System.Management.Automation.PSCredential ]::new($_.Value.Username , (ConvertTo-SecureString - AsPlainText $_.Value.Password - Force))
374374 }
375375 else {
376- $dscResourceInstance .$ ($_.Name ) = $_.Value.psobject.properties | ForEach-Object - Begin { $propertyHash = @ {} } - Process { $propertyHash [$_.Name ] = $_.Value } - End { $propertyHash }
376+ $property .$ ($_.Name ) = $_.Value.psobject.properties | ForEach-Object - Begin { $propertyHash = @ {} } - Process { $propertyHash [$_.Name ] = $_.Value } - End { $propertyHash }
377377 }
378378 }
379379 else {
@@ -414,7 +414,7 @@ function Invoke-DscOperation {
414414 $DesiredState.properties.psobject.properties | ForEach-Object - Process {
415415 # handle input objects by converting them to a hash table
416416 if ($_.Value -is [System.Management.Automation.PSCustomObject ]) {
417- $validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Value
417+ $validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Name
418418 if ($validateProperty.PropertyType -eq ' PSCredential' ) {
419419 if (-not $_.Value.Username -and -not $_.Value.Password ) {
420420 " Credential property '$ ( $_.Name ) ' requires both username and password input object" | Write-DscTrace - Operation Error
@@ -472,16 +472,16 @@ function Invoke-DscOperation {
472472 # morph the INPUT object into a hashtable named "property" for the cmdlet Invoke-DscResource
473473 $DesiredState.properties.psobject.properties | ForEach-Object - Begin { $property = @ {} } - Process {
474474 if ($_.Value -is [System.Management.Automation.PSCustomObject ]) {
475- $validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Value
475+ $validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Name
476476 if ($validateProperty.PropertyType -eq ' PSCredential' ) {
477477 if (-not $_.Value.Username -and -not $_.Value.Password ) {
478478 " Credential property '$ ( $_.Name ) ' requires both username and password input object" | Write-DscTrace - Operation Error
479479 exit 1
480480 }
481- $dscResourceInstance .$ ($_.Name ) = [System.Management.Automation.PSCredential ]::new($_.Value.Username , (ConvertTo-SecureString - AsPlainText $_.Value.Password - Force))
481+ $property .$ ($_.Name ) = [System.Management.Automation.PSCredential ]::new($_.Value.Username , (ConvertTo-SecureString - AsPlainText $_.Value.Password - Force))
482482 }
483483 else {
484- $dscResourceInstance .$ ($_.Name ) = $_.Value.psobject.properties | ForEach-Object - Begin { $propertyHash = @ {} } - Process { $propertyHash [$_.Name ] = $_.Value } - End { $propertyHash }
484+ $property .$ ($_.Name ) = $_.Value.psobject.properties | ForEach-Object - Begin { $propertyHash = @ {} } - Process { $propertyHash [$_.Name ] = $_.Value } - End { $propertyHash }
485485 }
486486 }
487487 else {
0 commit comments