Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# yaml-language-server: $schema=https://aka.ms/dsc/schemas/v3/bundled/config/document.vscode.json
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Operating System Assertion
type: Microsoft.DSC/Assertion
properties:
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Minimum operating system version
type: Microsoft/OSInfo
properties:
version: '>= 10.0'
- name: Show operating system
type: Microsoft.DSC.Debug/Echo
properties:
output: 'The operating system meets the minimum version requirement.'
dependsOn:
- "[resourceId('Microsoft.DSC/Assertion', 'Operating System Assertion')]"
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
description: Validate a minimum operating system version with Microsoft/OSInfo
ms.date: 07/11/2026
ms.topic: reference
title: Validate a minimum operating system version
---

# Validate a minimum operating system version

This example uses the `Microsoft/OSInfo` resource with the `Microsoft.DSC/Assertion` group
resource to verify that the operating system version meets a minimum requirement before DSC runs
another resource.

> [!IMPORTANT]
> The `osinfo` command and `Microsoft/OSInfo` resource are a proof-of-concept example for use with
> DSC. Don't use it in production.

## Definition

The **Operating System Assertion** group contains a `Microsoft/OSInfo` resource instance with the
version constraint `>= 10.0`. The `Microsoft.DSC/Assertion` resource always invokes **Test** for
nested instances. If the operating system is earlier than version `10.0`, the configuration fails
and DSC doesn't invoke **Show operating system**.

:::code language="yaml" source="validate-minimum-version.config.dsc.yaml":::

## Running the configuration

Run the configuration with the [dsc config set][01] command:

```bash
dsc config set --file ./validate-minimum-version.config.dsc.yaml
```

On an operating system whose version is at least `10.0`, DSC returns successful results for both
the assertion group and the dependent echo resource:

```yaml
results:
- name: Operating System Assertion
type: Microsoft.DSC/Assertion
result:
beforeState:
- name: Minimum operating system version
type: Microsoft/OSInfo
result:
actualState:
family: Windows
version: 10.0.26200
_inDesiredState: true
afterState:
- name: Minimum operating system version
type: Microsoft/OSInfo
result:
desiredState:
version: '>= 10.0'
actualState:
family: Windows
version: 10.0.26200
edition: Windows 11
bitness: 64
architecture: x86_64
_inDesiredState: true
inDesiredState: true
differingProperties:
- version
changedProperties: []
- name: Show operating system
type: Microsoft.DSC.Debug/Echo
result:
beforeState:
output: The operating system meets the minimum version requirement.
afterState:
output: The operating system meets the minimum version requirement.
changedProperties: null
messages: []
hadErrors: false
```

<!-- Link references -->
[01]: ../../../../cli/config/set.md
26 changes: 17 additions & 9 deletions docs/reference/resources/Microsoft/OSInfo/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: Microsoft/OSInfo DSC resource reference documentation
ms.date: 03/25/2025
ms.date: 07/11/2026
ms.topic: reference
title: Microsoft/OSInfo
---
Expand Down Expand Up @@ -46,10 +46,9 @@ The `Microsoft/OSInfo` resource enables you to assert whether a machine meets cr
the operating system. The resource is only capable of assertions. It doesn't implement the set
operation and can't configure the operating system.

The resource doesn't implement the [test operation][01]. It relies on the synthetic testing feature
of DSC instead. The synthetic test uses a case-sensitive equivalency comparison between the actual
state of the instance properties and the desired state. If any property value isn't an exact match,
DSC considers the instance to be out of the desired state.
The resource implements the [test operation][01]. The test operation compares every specified
instance property to the actual operating system information. The `version` property supports
version comparison constraints; all other properties use case-sensitive equality comparison.
Comment on lines +49 to +51

The instance properties returned by this resource depend on the operating system `family` as
listed in the following table:
Expand All @@ -75,11 +74,9 @@ None.
This resource has the following capabilities:

- `get` - You can use the resource to retrieve the actual state of an instance.
- `test` - You can use the resource to test whether an instance is in the desired state.
- `export` - You can use the resource to retrieve the actual state of every instance.

This resource uses the synthetic test functionality of DSC to determine whether an instance is
in the desired state.

This resource doesn't have the `set` capability. You can't use it to modify the state of a system.

For more information about resource capabilities, see
Expand All @@ -89,6 +86,7 @@ For more information about resource capabilities, see

1. [Validate operating system information with dsc resource][03]
1. [Validate operating system information in a configuration][04]
1. [Validate a minimum operating system version in a configuration][07]
Comment on lines 87 to +89

## Properties

Expand Down Expand Up @@ -210,7 +208,16 @@ IsWriteOnly : false

</details>

Defines the version of the operating system as a string.
Defines the version of the operating system as a string. During the **Test** operation, this
property accepts an exact version string or a version comparison constraint.

The supported comparison operators are `>`, `<`, `=`, `>=`, and `<=`. Whitespace between the
operator and version is optional. When you omit an operator, the resource performs an exact string
comparison. For example, `10.0`, `=10.0`, and `= 10.0` require an exact match, while `>= 10.0`
requires the operating system version to be at least `10.0`.

The version value after an operator must begin with a digit. Unsupported operators, such as `~=`,
are treated as literal exact-match values and won't match a normal operating system version.

### $id

Expand Down Expand Up @@ -256,3 +263,4 @@ operation failure.
[04]: examples/validate-in-a-configuration.md
[05]: ../../../../concepts/resources/properties.md#read-only-resource-properties
[06]: ../../../tools/osinfo.md
[07]: examples/validate-minimum-version.md