@@ -365,9 +365,10 @@ function Invoke-DscOperation {
365
365
$DesiredState.properties.psobject.properties | ForEach-Object - Begin { $property = @ {} } - Process {
366
366
if ($_.Value -is [System.Management.Automation.PSCustomObject ]) {
367
367
$validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Name
368
- if ($validateProperty.PropertyType -eq ' PSCredential' ) {
369
- if (-not $_.Value.Username -and -not $_.Value.Password ) {
370
- " Credential property '$ ( $_.Name ) ' requires both username and password input object" | Write-DscTrace - Operation Error
368
+ $validateProperty | Write-DscTrace - Operation Debug
369
+ if ($validateProperty.PropertyType -eq ' [PSCredential]' ) {
370
+ if (-not $_.Value.Username -or -not $_.Value.Password ) {
371
+ " The PSCredential property '$ ( $_.Name ) ' is missing required fields 'Username' and 'Password'" | Write-DscTrace - Operation Error
371
372
exit 1
372
373
}
373
374
$property .$ ($_.Name ) = [System.Management.Automation.PSCredential ]::new($_.Value.Username , (ConvertTo-SecureString - AsPlainText $_.Value.Password - Force))
@@ -415,9 +416,9 @@ function Invoke-DscOperation {
415
416
# handle input objects by converting them to a hash table
416
417
if ($_.Value -is [System.Management.Automation.PSCustomObject ]) {
417
418
$validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Name
418
- if ($validateProperty.PropertyType -eq ' PSCredential' ) {
419
- if (-not $_.Value.Username -and -not $_.Value.Password ) {
420
- " Credential property '$ ( $_.Name ) ' requires both username and password input object " | Write-DscTrace - Operation Error
419
+ if ($validateProperty.PropertyType -eq ' [ PSCredential] ' ) {
420
+ if (-not $_.Value.Username -or -not $_.Value.Password ) {
421
+ " The PSCredential property '$ ( $_.Name ) ' is missing required fields 'Username' and 'Password' " | Write-DscTrace - Operation Error
421
422
exit 1
422
423
}
423
424
$dscResourceInstance .$ ($_.Name ) = [System.Management.Automation.PSCredential ]::new($_.Value.Username , (ConvertTo-SecureString - AsPlainText $_.Value.Password - Force))
@@ -473,9 +474,9 @@ function Invoke-DscOperation {
473
474
$DesiredState.properties.psobject.properties | ForEach-Object - Begin { $property = @ {} } - Process {
474
475
if ($_.Value -is [System.Management.Automation.PSCustomObject ]) {
475
476
$validateProperty = $cachedDscResourceInfo.Properties | Where-Object - Property Name -EQ $_.Name
476
- if ($validateProperty.PropertyType -eq ' PSCredential' ) {
477
- if (-not $_.Value.Username -and -not $_.Value.Password ) {
478
- " Credential property '$ ( $_.Name ) ' requires both username and password input object " | Write-DscTrace - Operation Error
477
+ if ($validateProperty.PropertyType -eq ' [ PSCredential] ' ) {
478
+ if (-not $_.Value.Username -or -not $_.Value.Password ) {
479
+ " The PSCredential property '$ ( $_.Name ) ' is missing required fields 'Username' and 'Password' " | Write-DscTrace - Operation Error
479
480
exit 1
480
481
}
481
482
$property .$ ($_.Name ) = [System.Management.Automation.PSCredential ]::new($_.Value.Username , (ConvertTo-SecureString - AsPlainText $_.Value.Password - Force))
0 commit comments