diff --git a/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 b/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 index 4d635133..a73ffd3e 100644 --- a/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 +++ b/powershell-adapter/Tests/powershellgroup.resource.tests.ps1 @@ -280,4 +280,11 @@ Describe 'PowerShell adapter resource tests' { $env:TestClassResourceResultCount = $null } + + It 'Does not work when Get is empty' { + $out = dsc resource get --resource Microsoft.DSC/PowerShell 2>&1 | Out-String + $LASTEXITCODE | Should -Be 2 + $out | Should -Not -BeNullOrEmpty + $out | Should -BeLike "*ERROR*Can not find type `"`" for resource*" + } } diff --git a/powershell-adapter/psDscAdapter/powershell.resource.ps1 b/powershell-adapter/psDscAdapter/powershell.resource.ps1 index acaafad5..67b302f7 100644 --- a/powershell-adapter/psDscAdapter/powershell.resource.ps1 +++ b/powershell-adapter/psDscAdapter/powershell.resource.ps1 @@ -66,6 +66,11 @@ if ($jsonInput) { if ($jsonInput -ne '@{}') { $inputobj_pscustomobj = $jsonInput | ConvertFrom-Json } + else + { + $jsonInput = $jsonInput | ConvertTo-Json + } + $new_psmodulepath = $inputobj_pscustomobj.psmodulepath if ($new_psmodulepath) {