Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/concepts/output-accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dsc resource list | ConvertFrom-Json | Out-GridView
The following example shows how to display a list of DSC adapted resources in a GridView control.

```powershell
dsc resource list -a Microsoft.Windows/WindowsPowerShell |
dsc resource list -a Microsoft.Adapter/WindowsPowerShell |
ConvertFrom-Json |
Out-GridView
```
Expand Down Expand Up @@ -83,7 +83,7 @@ Each of the following commands improves the output in a different way:
experience for screen readers.

```powershell
dsc resource list -a Microsoft.Windows/WindowsPowerShell |
dsc resource list -a Microsoft.Adapter/WindowsPowerShell |
ConvertFrom-Json |
Where-Object {$_.type -like "*process*" } |
Select-Object -Property Type, Kind, Version |
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/resources/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DSC supports several kinds of resources:
resource instances and processes them. Group resources can apply special handling to their nested
resource instances, like changing the user the resources run as.
- An _adapter resource_ is a group resource that enables the use of noncommand resources with DSC.
For example, the `Microsoft.DSC/PowerShell` and `Microsoft.Windows/WindowsPowerShell` adapter
For example, the `Microsoft.Adapter/PowerShell` and `Microsoft.Adapter/WindowsPowerShell` adapter
resources enable the use of PowerShell DSC (PSDSC) resources in DSC, invoking the resources in
PowerShell and Windows PowerShell respectively.

Expand Down
6 changes: 3 additions & 3 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ DSC differs from PowerShell Desired State Configuration (PSDSC) in a few importa

- DSC doesn't _depend_ on PowerShell, Windows PowerShell, or the [PSDesiredStateConfiguration][01]
PowerShell module. DSC provides full compatibility with PSDSC resources through the
`Microsoft.DSC/PowerShell` and `Microsoft.Windows/WindowsPowerShell` _adapter resources_.
`Microsoft.Adapter/PowerShell` and `Microsoft.Adapter/WindowsPowerShell` _adapter resources_.

With the `Microsoft.DSC/PowerShell` adapter resource, you can use any PSDSC resource implemented
With the `Microsoft.Adapter/PowerShell` adapter resource, you can use any PSDSC resource implemented
as a PowerShell class. The resource handles discovering, validating, and invoking PSDSC
resources in PowerShell. The resource is included in the DSC install package for every platform.

With the `Microsoft.Windows/WindowsPowerShell` adapter resource, you can use any PSDSC resource
With the `Microsoft.Adapter/WindowsPowerShell` adapter resource, you can use any PSDSC resource
compatible with Windows PowerShell. The resource handles discovering, validating, and invoking
Comment thread
Gijsreyn marked this conversation as resolved.
PSDSC resources in Windows PowerShell. The resource is included in the DSC install packages for
Windows only.
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cli/resource/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ adds the returned list of adapted resources to the discovered resource list. DSC
further filters specified with the command after this enumeration.

```sh
dsc resource list --adapter Microsoft.Windows/WindowsPowerShell
dsc resource list --adapter Microsoft.Adapter/WindowsPowerShell
```

This next command specifies the resource name filter `*Windows*`, limiting the list of returned
resources:

```sh
dsc resource list --adapter Microsoft.Windows/WindowsPowerShell *Windows*
dsc resource list --adapter Microsoft.Adapter/WindowsPowerShell *Windows*
```

## Arguments
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
---
description: >
Example showing how to configure a machine using multiple class-based PowerShell DSC resources
with the Microsoft.Adapter/PowerShell adapter in a DSC configuration document.

ms.date: 03/23/2026
ms.topic: reference
title: Configure a machine with the PowerShell adapter
---

# Configure a machine with the PowerShell adapter

This example shows how to use the `Microsoft.Adapter/PowerShell` adapter to configure a machine
using multiple class-based PowerShell DSC resources in a single configuration document. These
examples use the `Microsoft.WinGet.DSC/WinGetPackage` resource from the **Microsoft.WinGet.DSC**
module to ensure several packages are installed.

## Definition

The following configuration document defines multiple `Microsoft.WinGet.DSC/WinGetPackage`
instances.

Save the following YAML as `dev-tools.dsc.yaml`:

```yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
parameters:
ensureTools:
type: string
defaultValue: Present
allowedValues:
- Present
- Absent
resources:
- name: Windows Terminal
type: Microsoft.WinGet.DSC/WinGetPackage
properties:
Id: Microsoft.WindowsTerminal
Ensure: "[parameters('ensureTools')]"
- name: Visual Studio Code
type: Microsoft.WinGet.DSC/WinGetPackage
properties:
Id: Microsoft.VisualStudioCode
Ensure: "[parameters('ensureTools')]"
```

## Setup

This example installs the WinGet software packages for the Windows Terminal and VS Code. The output
in this example shows the behavior when these packages aren't already installed on the system.

This example depends on the **Microsoft.WinGet.DSC** PowerShell module at version `1.12.440`. To
install the module, open a PowerShell session and invoke the following command:

```powershell
Install-PSResource -Name Microsoft.WinGet.DSC -Version 1.12.440
```

> [!WARNING]
> Uninstalling and reinstalling software may have unintentional side effects related to how that
> software behaves, especially if uninstalling the software removes all previously defined
> configuration for it.

To ensure that the packages aren't installed, invoke the following commands:

```powershell
winget uninstall --id Microsoft.WindowsTerminal
winget uninstall --id Microsoft.VisualStudioCode
```

## Test the configuration

To see whether the system is in the desired state, use the [`dsc config test`][01] command on the
configuration document.

```powershell
dsc config test --file dev-tools.dsc.yaml
```

DSC reports the results for each instance, showing which packages need to be installed. For this
example, neither package shows as installed:

```yaml
executionInformation:
# Elided for brevity
metadata:
# Elided for brevity
results:
- executionInformation:
duration: PT8.0298239S
metadata:
Microsoft.DSC:
duration: PT8.0298239S
name: Windows Terminal
type: Microsoft.WinGet.DSC/WinGetPackage
result:
desiredState:
Id: Microsoft.WindowsTerminal
Ensure: Present
actualState:
Version: null
MatchOption: EqualsCaseInsensitive
UseLatest: false
InstallMode: Silent
Id: Microsoft.WindowsTerminal
Ensure: Absent
Source: ''
_inDesiredState: false
inDesiredState: false
differingProperties:
- Ensure
- executionInformation:
duration: PT7.6445836S
metadata:
Microsoft.DSC:
duration: PT7.6445836S
name: Visual Studio Code
type: Microsoft.WinGet.DSC/WinGetPackage
result:
desiredState:
Id: Microsoft.VisualStudioCode
Ensure: Present
actualState:
UseLatest: false
Version: null
Source: ''
Ensure: Absent
Id: Microsoft.VisualStudioCode
MatchOption: EqualsCaseInsensitive
InstallMode: Silent
_inDesiredState: false
inDesiredState: false
differingProperties:
- Ensure
messages: []
hadErrors: false
```

## Apply the configuration

Use the [`dsc config set`][02] command to install any packages that aren't already present:

```powershell
dsc config set --file dev-tools.dsc.yaml
```

```yaml
executionInformation:
# Elided for brevity
metadata:
# Elided for brevity
results:
- executionInformation:
duration: PT34.4280028S
metadata:
Microsoft.DSC:
duration: PT34.4280028S
name: Windows Terminal
type: Microsoft.WinGet.DSC/WinGetPackage
result:
beforeState:
InstallMode: Silent
UseLatest: false
Source: ''
Id: Microsoft.WindowsTerminal
Ensure: Absent
Version: null
MatchOption: EqualsCaseInsensitive
afterState:
Version: 1.24.10921.0
UseLatest: true
Source: winget
InstallMode: Silent
Ensure: Present
MatchOption: EqualsCaseInsensitive
Id: Microsoft.WindowsTerminal
changedProperties:
- Version
- UseLatest
- Source
- Ensure
- executionInformation:
duration: PT11.6464059S
metadata:
Microsoft.DSC:
duration: PT11.6464059S
name: Visual Studio Code
type: Microsoft.WinGet.DSC/WinGetPackage
result:
beforeState:
UseLatest: false
Ensure: Absent
Id: Microsoft.VisualStudioCode
MatchOption: EqualsCaseInsensitive
InstallMode: Silent
Source: ''
Version: null
afterState:
Id: Microsoft.VisualStudioCode
MatchOption: EqualsCaseInsensitive
Source: winget
Version: 1.119.0
InstallMode: Silent
Ensure: Present
UseLatest: true
changedProperties:
- Source
- Version
- Ensure
- UseLatest
messages: []
hadErrors: false
```

DSC installed both of the missing packages and reports that the state of each instance was changed
during the `set` operation.

## Remove the packages

To uninstall the packages, override the `ensureTools` parameter when applying the configuration:

```powershell
$params = @{
parameters = @{
ensureTools = 'Absent'
}
} | ConvertTo-Json -Compress

dsc config --parameters $params set --file dev-tools.dsc.yaml
```

<!-- Link references -->
[01]: ../../../../../../cli/config/test.md
[02]: ../../../../../../cli/config/set.md
Loading
Loading