Skip to content

Commit 9360f3f

Browse files
committed
Update remarks
1 parent d2ffdf2 commit 9360f3f

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

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

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ execute a simple command during the **Set** operation.
1414

1515
## Test whether the command would run
1616

17-
The following snippet shows how you can use the resource with the [dsc resource test][01] command to check whether the command would run.
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.
1819

1920
> [!NOTE]
2021
> The `dsc resource test` command performs a synthetic test on this resource. `Microsoft.DSC.Transitional/RunCommandOnSet` doesn't have
21-
> the `test` capability defined in the [resource manifest][02]
22+
> the `test` capability defined in the [resource manifest][01]
2223
2324
```powershell
2425
$instance = @{
25-
executable = "echo"
26-
arguments = @("Configuration applied successfully")
26+
executable = "C:\Windows\system32\cmd.exe"
27+
arguments = @(
28+
'/C',
29+
'echo Hello world'
30+
)
2731
} | ConvertTo-Json
2832
2933
dsc resource test --resource Microsoft.DSC.Transitional/RunCommandOnSet --input $instance
@@ -34,30 +38,26 @@ When testing the resource, DSC returns a result indicating the desired state:
3438
```yaml
3539
desiredState:
3640
arguments:
37-
- Configuration applied successfully
38-
executable: echo
41+
- /C
42+
- echo Hello world
43+
executable: C:\Windows\system32\cmd.exe
3944
actualState:
40-
executable: echo
45+
executable: C:\Windows\system32\cmd.exe
4146
arguments:
42-
- Configuration applied successfully
47+
- /C
48+
- echo Hello world
4349
inDesiredState: true
4450
differingProperties: []
4551
```
4652
47-
The `inDesiredState` field of the result object is set to `true`, indicating that the command would be executed during a **Set** operation.
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.
4855

4956
## Run the command
5057

5158
To execute the command, use the [dsc resource set][03] command.
5259

5360
```powershell
54-
$instance = @{
55-
executable = "C:\Windows\system32\cmd.exe"
56-
arguments = @(
57-
'/C',
58-
'echo Hello world'
59-
)
60-
} | ConvertTo-Json
6161
dsc resource set --resource Microsoft.DSC.Transitional/RunCommandOnSet --input $instance
6262
```
6363

@@ -84,6 +84,7 @@ changedProperties: []
8484
> If you want to capture the output, you should redirect it to a file.
8585

8686
<!-- Link reference definitions -->
87-
[01]: ../../../../../cli/resource/test.md
88-
[02]: ../../../../../../schemas/resource/manifest/test.md
87+
[00]: ../../../../../cli/resource/test.md
88+
[01]: ../../../../../../schemas/resource/manifest/test.md
89+
[02]: ../../../../../../../reference/cli/resource/set.md
8990
[03]: ../../../../../cli/resource/set.md

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ The resource allows you to:
5151
- Pass arguments to the executable
5252
- Define a custom exit code to indicate success
5353

54+
> [!IMPORTANT]
55+
> The **Get** operation for this resource does not return any output from the executed command.
56+
> Additionally, when using the **Test** operation, the resource always reports as being
57+
> in the desired state.
58+
5459
## Capabilities
5560

5661
The resource has the following capabilities:
@@ -64,10 +69,8 @@ the desired state. For more information about resource capabilities, see
6469

6570
## Examples
6671

67-
1. [Run a simple command][01] - Shows how to create and delete registry keys with the
68-
`dsc resource` commands.
69-
1. [Run a PowerShell command][02] - Shows how to create, modify, and delete registry values with the
70-
`dsc resource` commands.
72+
1. [Run a simple command][01] - Shows how to run a simple command.
73+
1. [Run a PowerShell command][02] - Shows how you can run a PowerShell command.
7174

7275
## Properties
7376

0 commit comments

Comments
 (0)