PowerShell / PSDesiredStateConfiguration

Source for https://www.powershellgallery.com/packages/PSDesiredStateConfiguration module
MIT License
60 stars 14 forks source link

Get-DscResource should throw an error when -Name is specified but the resource doesn't exist #17

Open TravisEz13 opened 5 years ago

TravisEz13 commented 5 years ago

Repro

Get-DscResource -name foobar

Expected

CheckResourceFound : The term 'foobar' is not recognized as the name of a Resource.                                                                              
At /Users/travisplunk/git/PSDesiredStateConfiguration/src/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1:4019 char:13                              
+             CheckResourceFound $Name $Resources                                                                                                                
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException                                                                                   
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,CheckResourceFound

Actual