@@ -12,14 +12,9 @@ title: Run a simple command
1212This example shows how you can use the ` Microsoft.DSC.Transitional/RunCommandOnSet ` resource to
1313execute a simple command during the ** Set** operation.
1414
15- ## Test whether the command would run
16-
17- The following snippet shows how you can use the resource with the [ dsc resource test] [ 00 ] command to check whether
18- the command would run.
15+ ## Run the command
1916
20- > [ !NOTE]
21- > The ` dsc resource test ` command performs a synthetic test on this resource. ` Microsoft.DSC.Transitional/RunCommandOnSet ` doesn't have
22- > the ` test ` capability defined in the [ resource manifest] [ 01 ]
17+ The following snippet shows how you can invoke the resource to execute a custom command with [ dsc resource set] [ 00 ] .
2318
2419``` powershell
2520$instance = @{
@@ -29,35 +24,6 @@ $instance = @{
2924 'echo Hello world'
3025 )
3126} | ConvertTo-Json
32-
33- dsc resource test --resource Microsoft.DSC.Transitional/RunCommandOnSet --input $instance
34- ```
35-
36- When testing the resource, DSC returns a result indicating the desired state:
37-
38- ``` yaml
39- desiredState :
40- arguments :
41- - /C
42- - echo Hello world
43- executable : C:\Windows\system32\cmd.exe
44- actualState :
45- executable : C:\Windows\system32\cmd.exe
46- arguments :
47- - /C
48- - echo Hello world
49- inDesiredState : true
50- differingProperties : []
51- ` ` `
52-
53- The ` inDesiredState` field always returns `true` because of [pretest][02] is supported.
54- This means the command is always executed during the **Set** operation.
55-
56- # # Run the command
57-
58- To execute the command, use the [dsc resource set][03] command.
59-
60- ` ` ` powershell
6127dsc resource set --resource Microsoft.DSC.Transitional/RunCommandOnSet --input $instance
6228```
6329
@@ -84,7 +50,4 @@ changedProperties: []
8450> If you want to capture the output, you should redirect it to a file.
8551
8652<!-- Link reference definitions -->
87- [00] : ../../../../../cli/resource/test.md
88- [01] : ../../../../../../schemas/resource/manifest/test.md
89- [02] : ../../../../../../../reference/cli/resource/set.md
90- [03] : ../../../../../cli/resource/set.md
53+ [00] : ../../../../../cli/resource/set.md
0 commit comments