You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: RuleDocumentation/UseIdenticalMandatoryParametersForDSC.md
+60-20Lines changed: 60 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,50 +4,74 @@
4
4
5
5
## Description
6
6
7
-
The `Get-TargetResource`, `Test-TargetResource` and `Set-TargetResource` functions of DSC Resource must have the same mandatory parameters.
7
+
For script based DSC resources, if a property is declared with attributes `Key` of `Required` in a mof file, then is should be present as a mandatory parameter in the corresponding `Get-TargetResource`, `Set-TargetResource` and `Test-TargetResource` functions.
8
8
9
9
## How
10
10
11
-
Correct the mandatory parameters for the functions in DSC resource.
11
+
Make sure all the properties with `Key` and `Required` attributes have equivalent mandatory parameters in the `Get/Set/Test` functions.
12
12
13
13
## Example
14
14
15
+
Consider the following `mof` file.
16
+
17
+
```powershell
18
+
class WaitForAny : OMI_BaseResource
19
+
{
20
+
[key, Description("Name of Resource on remote machine")]
21
+
string Name;
22
+
23
+
[required, Description("List of remote machines")]
0 commit comments