[X] Make sure you are able to repro it on the latest version
[X] Search the existing issues.
Steps to reproduce
'{"Name": "bits","State": "Running"}' | dsc resource get -r PsDscResources/MSFT_ServiceResource
Expected behavior
actualState:
DesktopInteract: false
Name: bits
BuiltInAccount: LocalSystem
State: Stopped
Ensure: Present
Description: Transfers files in the background using idle network bandwidth. If the service is disabled, then any applications that depend on BITS, such as Windows Update or MSN Explorer, will be unable to automatically download programs and other information.
StartupType: Manual
Dependencies:
- RpcSs
Path: C:\WINDOWS\System32\svchost.exe -k netsvcs -p
DisplayName: Background Intelligent Transfer Service
Actual behavior
Error: Command: Resource 'DSC/PowerShellGroup' [Exit code 1] Get-TargetResource: A parameter cannot be found that matches parameter name 'State'.
Error details
This happens because script based resources do not enforce parameter validation, and in many cases "Get" does not implement all parameters.
Example:
https://github.com/PowerShell/PSDscResources/blob/7064eda52d939a4a3ce40e1f38756cfe6a09acfd/DscResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1#L37
We could solve this issue in PSDesiredStateConfiguration, but then DSCv3 would require that version or later. When we have created dependencies like that in the past, it made adoption more difficult.
Prerequisites
Steps to reproduce
'{"Name": "bits","State": "Running"}' | dsc resource get -r PsDscResources/MSFT_ServiceResource
Expected behavior
Actual behavior
Error details
Environment data
Version
0.2.0
Visuals
No response