Skip to content

Microsoft/OSInfo: Support minimum version assertion (>= comparison) #1521

@denelon

Description

@denelon

Summary of the new feature / enhancement

The Microsoft/OSInfo resource currently performs exact string matching on the version property. This means asserting version: "10.0.22621" fails on a machine running 10.0.26614 — even though the machine exceeds the minimum requirement.

For configuration authors using Microsoft/OSInfo in assertions (e.g., "this config requires Windows 11 22H2 or later"), there's no way to express a minimum version constraint.

Observed behavior

dsc resource test -r Microsoft/OSInfo --input '{"family": "Windows", "version": "10.0.22621"}'

On a machine running 10.0.26614:

inDesiredState: false
differingProperties:
- version

Expected behavior

A way to specify that version should be treated as a minimum (>=) rather than an exact match. For example:

- name: assert_min_os
  type: Microsoft/OSInfo
  properties:
    family: Windows
    minVersion: "10.0.22621"

Or alternatively, support a comparison operator on the version property:

  properties:
    version:
      minimum: "10.0.22621"

Use case

WinGet Configuration files that need to assert a minimum OS version before applying resources (e.g., Dev Drive requires 22H2+, certain Windows Settings resources require specific builds). The Microsoft.Windows.Developer/OsVersion resource in WinGet DSC v2 supported MinVersion for this purpose — the native Microsoft/OSInfo resource would be the faster v3 equivalent if it supported minimum version comparison.

Additional context

  • Microsoft/OSInfo capabilities are get + export (read-only, no set) — ideal for assertions
  • It's a native Rust binary so it's extremely fast compared to PowerShell-based alternatives
  • Semantic version comparison (or at minimum numeric dotted-version comparison) would make this resource the canonical way to gate configs by OS version
  • Related: Assertion section in config doc #1421 (assertion section in config docs)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions