Skip to content

Commit 0ed58f1

Browse files
committed
Forgot to commit
1 parent d5d13b5 commit 0ed58f1

2 files changed

Lines changed: 81 additions & 80 deletions

File tree

  • docs/reference/resources/Microsoft/adapter

docs/reference/resources/Microsoft/adapter/powershell/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ You can directly call the adapter script to clear the cache with the **Operation
8585
set to `ClearCache`:
8686

8787
```powershell
88-
$adapterScript = dsc resource list -a Microsoft.Adapter/PowerShell |
88+
$adapterScript = dsc resource list Microsoft.Adapter/PowerShell |
8989
ConvertFrom-Json |
9090
Select-Object -ExpandProperty directory |
9191
Join-Path -ChildPath 'psDscAdapter' -AdditionalChildPath 'powershell.resource.ps1'

docs/reference/resources/Microsoft/adapter/windowspowershell/index.md

Lines changed: 80 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,26 @@ Tags: [windows, powershell]
2020
Executable: powershell
2121
```
2222
23-
## Instance definition syntax
23+
## Adapted resource instance definition syntax
2424
25-
> [!NOTE]
26-
> The `directives.requireAdapter` syntax is available in DSC 3.2 and later.
25+
### Implicitly required adapter syntax
26+
27+
```yaml
28+
- name: <instance name>
29+
type: <module name>/<resource name>
30+
properties: # adapted resource properties
31+
<property name>: <property value>
32+
```
33+
34+
### Explicitly required adapter syntax
2735
2836
```yaml
29-
resources:
3037
- name: <instance name>
3138
type: <module name>/<resource name>
39+
properties: # adapted resource properties
40+
<property name>: <property value>
3241
directives:
3342
requireAdapter: Microsoft.Adapter/WindowsPowerShell
34-
properties: # adapted resource properties
3543
```
3644
3745
## Description
@@ -45,19 +53,22 @@ State Configuration (PSDSC) resources in DSC. The resource can:
4553

4654
The adapter manages the PSDSC resources in Windows PowerShell (powershell.exe), not PowerShell
4755
(pwsh). To use class-based PSDSC resources in PowerShell, use the
48-
[Microsoft.Adapter/PowerShell](../powershell/index.md) adapter.
56+
[Microsoft.Adapter/PowerShell][01] adapter.
4957

5058
This adapter uses the **PSDesiredStateConfiguration** module v1.1. This module is built-in when
5159
you install Windows and is located in
5260
`%SystemRoot%\System32\WindowsPowerShell\v1.0\Modules`.
5361

5462
> [!NOTE]
55-
> This adapter replaces the deprecated
56-
> [Microsoft.Windows/WindowsPowerShell](../../Windows/WindowsPowerShell/index.md) adapter. In
57-
> earlier versions of DSC, adapted resources were nested inside a parent adapter resource using
63+
> This adapter replaces the deprecated [Microsoft.Windows/WindowsPowerShell][02] adapter.
64+
>
65+
> In earlier versions of DSC, adapted resources were nested inside a parent adapter resource using
5866
> the `properties.resources` array. Starting in DSC 3.2, each adapted resource is listed directly
59-
> in the configuration document's `resources` array with `directives.requireAdapter` set to
60-
> `Microsoft.Adapter/WindowsPowerShell`.
67+
> in the configuration document's `resources` array.
68+
>
69+
> You can use the [`requireAdapter` directive][03] to explicitly indicate that the instance should
70+
> use this adapter. When you don't specify the `requireAdapter` directive, DSC invokes the adapted
71+
> resource through the first adapter that indicates it can invoke the resource.
6172

6273
### PowerShell resource adapter cache
6374

@@ -97,96 +108,82 @@ $adapterScript = dsc resource list Microsoft.Adapter/WindowsPowerShell |
97108
## Requirements
98109

99110
- This adapter is only available on Windows.
100-
- The process context must have appropriate permissions for the DSC resources to be executed.
101-
- PowerShell modules exposing DSC resources should be installed in one of the following locations:
111+
- The process security context must be elevated.
112+
113+
For PSDSC 1.1, invoking DSC resources requires the process to run as Administrator. Attempting to
114+
invoke the resources in a non-elevated context fails.
115+
- Windows PowerShell Desired State Configuration (PSDSC) depends on WinRM. If WinRM isn't setup on
116+
the machine, invoking PSDSC resources through the adapter will raise an error.
117+
118+
You can use the [`Enable-PSRemoting` cmdlet][04] in an elevated Windows PowerShell session to
119+
enable WinRM.
120+
- PowerShell modules exposing PSDSC resources for use with this adapter must be installed in one of
121+
the following locations:
122+
102123
- `%PROGRAMFILES%\WindowsPowerShell\Modules`
103124
- `%SystemRoot%\System32\WindowsPowerShell\v1.0\Modules`
104125

126+
PSDSC 1.1 only finds PSDSC resources when the module containing them is installed in the machine
127+
scope. Modules containing PSDSC resources in the user scope or another non-default location
128+
aren't recognized by PSDSC 1.1 and can't be invoked through this adapter.
129+
105130
## Capabilities
106131

107132
The resource adapter has the following capabilities:
108133

109-
- `get` - Retrieve the actual state of a DSC resource instance.
110-
- `set` - Enforce the desired state for a DSC resource instance.
111-
- `test` - Determine whether a DSC resource instance is in the desired state.
112-
- `export` - Discover and enumerate DSC resource instances available on the system.
113-
- `list` - List available Windows PowerShell DSC resources that can be used with `dsc.exe`.
134+
- `get` - Retrieve the actual state of an adapted DSC resource instance.
135+
- `set` - Enforce the desired state for an adapted DSC resource instance.
136+
- `test` - Determine whether an adapted DSC resource instance is in the desired state.
137+
- `export` - Discover and enumerate adapted DSC resource instances available on the system.
138+
- `list` - List available Windows PowerShell DSC resources that can be used as adapted DSC
139+
resources.
114140

115141
> [!NOTE]
116-
> The `export` capability is only available with class-based DSC resources. Script-based and
117-
> binary DSC resources don't support the export operation.
142+
> The `export` capability is only available for class-based PSDSC resources. Script-based and
143+
> binary PSDSC resources don't support the export operation.
118144

119145
## Examples
120146

121-
- [Manage a Windows service with the WindowsPowerShell adapter][02]
147+
- [Manage a Windows service with the WindowsPowerShell adapter][05]
122148

123149
## Adapted resource instances
124150

125-
Adapted resource instances are listed directly in the configuration document's `resources` array.
126-
Set `directives.requireAdapter` to `Microsoft.Adapter/WindowsPowerShell` to indicate that DSC
127-
should use this adapter to invoke the instance. This feature requires DSC 3.2 or later.
151+
Define adapted resource instances directly in the configuration document's `resources` array.
128152

129-
Every adapted instance must be an object that defines the [name](#adapted-instance-name),
130-
[type](#adapted-instance-type), and [properties](#adapted-instance-properties) for the instance.
153+
To explicitly indicate that DSC should use this adapter for the resource instance, define the
154+
`requireAdapter` directive as `Microsoft.Adapter/WindowsPowerShell`. When you don't specify the
155+
`requireAdapter` directive, DSC invokes the adapted resource through the first adapter that
156+
indicates it can invoke the resource.
131157

132-
### Adapted instance name
158+
Adapted resource instances are defined identically to non-adapted resource instances in a
159+
configuration document with the following exceptions:
133160

134-
The `name` property of the adapted resource instance defines the short, human-readable name for the
135-
instance. The adapted instance name must be a non-empty string containing only letters, numbers,
136-
and spaces. This property must be unique within the configuration document's `resources` array.
161+
1. The fully qualified type name (`type` field) for the adapted instance is defined by the adapter.
162+
This adapter uses the following syntax for determining the fully qualified type name of a PSDSC
163+
resource:
137164

138-
```yaml
139-
PropertyName: name
140-
Type: string
141-
Required: true
142-
MinimumLength: 1
143-
Pattern: ^[a-zA-Z0-9 ]+$
144-
```
145-
146-
### Adapted instance type
147-
148-
The `type` property identifies the adapted instance's PSDSC resource. The value for this property
149-
must be the valid fully qualified type name for the resource.
150-
151-
This adapter uses the following syntax for determining the fully qualified type name of a PSDSC
152-
resource:
153-
154-
```Syntax
155-
<module name>/<resource name>
156-
```
165+
```Syntax
166+
<module name>/<resource name>
167+
```
157168

158-
For example, if a PowerShell module named **TailspinToys** has a script-based PSDSC resource named
159-
`TSToy`, the fully qualified type name for that resource is `TailspinToys/TSToy`.
169+
For example, if a PowerShell module named **TailspinToys** has a script-based PSDSC resource named
170+
`TSToy`, the fully qualified type name for that resource is `TailspinToys/TSToy`.
160171

161-
For more information about type names in DSC, see
162-
[DSC Resource fully qualified type name schema reference][01].
172+
For more information about type names in DSC, see
173+
[DSC Resource fully qualified type name schema reference][06].
163174

164-
```yaml
165-
Type: string
166-
Required: true
167-
Pattern: ^\w+(\.\w+){0,2}\/\w+$
168-
```
169-
170-
### Adapted instance properties
171-
172-
The `properties` of an adapted resource instance define its desired state. The value of this
173-
property must be an object. The specified properties are validated at runtime when the adapter
174-
tries to invoke the adapted PSDSC resource instance. This adapter doesn't support static linting
175-
for adapted instance properties in a configuration document.
175+
1. The `properties` field for the instance is validated at runtime when the adapter tries to invoke
176+
the adapted PSDSC resource instance. This adapter doesn't support static linting for adapted
177+
instance properties in a configuration document.
176178

177-
Each name for each property must be a configurable property of the PSDSC resource. The property
178-
name isn't case sensitive. The value for each property must be valid for that property. If you
179-
specify an invalid property name or value, the adapter raises an error when it tries to invoke the
180-
resource.
181-
182-
```yaml
183-
Type: object
184-
Required: true
185-
```
179+
Each property name must be a configurable property of the PSDSC resource. The property name
180+
isn't case sensitive. The value for each property must be valid for that property. If you
181+
specify an invalid property name or value, the adapter raises an error when it tries to invoke
182+
the resource.
186183

187184
## Exit codes
188185

189-
The resource returns the following exit codes from operations:
186+
The adapter resource returns the following exit codes from operations:
190187

191188
- [0](#exit-code-0) - Success
192189
- [1](#exit-code-1) - Error
@@ -203,9 +200,13 @@ an error message with details about the failure.
203200

204201
## See also
205202

206-
- [Microsoft.Adapter/PowerShell](../powershell/index.md)
207-
- [Microsoft.Windows/WindowsPowerShell](../../Windows/WindowsPowerShell/index.md) (deprecated)
203+
- [Microsoft.Adapter/PowerShell][01]
204+
- [Microsoft.Windows/WindowsPowerShell][02] (deprecated)
208205

209206
<!-- Link references -->
210-
[01]: ../../../../concepts/type-names.md
211-
[02]: examples/manage-a-windows-service.md
207+
[01]: ../powershell/index.md
208+
[02]: ../../Windows/WindowsPowerShell/index.md
209+
[03]: ../../../../schemas/config/resource.md#requireAdapter
210+
[04]: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/enable-psremoting?view=powershell-5.1&preserveView=true
211+
[05]: examples/manage-a-windows-service.md
212+
[06]: ../../../../schemas/definitions/resourceType.md

0 commit comments

Comments
 (0)