Skip to content

Commit 5e1e4f3

Browse files
committed
Update simple command and resolve remarks
1 parent 9360f3f commit 5e1e4f3

File tree

2 files changed

+7
-43
lines changed

2 files changed

+7
-43
lines changed

docs/reference/resources/Microsoft/DSC/Transitional/RunCommandOnSet/examples/run-a-simple-command.md

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,9 @@ title: Run a simple command
1212
This example shows how you can use the `Microsoft.DSC.Transitional/RunCommandOnSet` resource to
1313
execute 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
6127
dsc 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

docs/reference/resources/Microsoft/DSC/Transitional/RunCommandOnSet/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The resource allows you to:
5454
> [!IMPORTANT]
5555
> The **Get** operation for this resource does not return any output from the executed command.
5656
> Additionally, when using the **Test** operation, the resource always reports as being
57-
> in the desired state.
57+
> in the desired state. DSC _always_ invokes the command during **Set**.
5858

5959
## Capabilities
6060

@@ -121,7 +121,8 @@ IsWriteOnly : false
121121
</details>
122122

123123
Defines the arguments to pass to the executable. Each element in the array represents a
124-
separate argument that will be passed to the executable.
124+
separate argument that will be passed to the executable. The arguments are passed
125+
in the same order that you specify them.
125126

126127
### exitCode
127128

@@ -138,7 +139,7 @@ DefaultValue : 0
138139

139140
</details>
140141

141-
Defines the expected exit code to indicate success if not zero. By default, an exit code of 0 indicates
142+
Defines the expected exit code to indicate success if not zero. By default, an exit code of `0` indicates
142143
successful execution. If your executable returns a different exit code to indicate success, specify that value here.
143144

144145
## Instance validating schema

0 commit comments

Comments
 (0)