@@ -12,14 +12,9 @@ title: Run a simple command
12
12
This example shows how you can use the ` Microsoft.DSC.Transitional/RunCommandOnSet ` resource to
13
13
execute a simple command during the ** Set** operation.
14
14
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
19
16
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 ] .
23
18
24
19
``` powershell
25
20
$instance = @{
@@ -29,35 +24,6 @@ $instance = @{
29
24
'echo Hello world'
30
25
)
31
26
} | 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
61
27
dsc resource set --resource Microsoft.DSC.Transitional/RunCommandOnSet --input $instance
62
28
```
63
29
@@ -84,7 +50,4 @@ changedProperties: []
84
50
> If you want to capture the output, you should redirect it to a file.
85
51
86
52
<!-- 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