Skip to content

Add Microsoft.Windows/OptionalFeatureList resource#1432

Merged
SteveL-MSFT merged 8 commits intoPowerShell:mainfrom
SteveL-MSFT:optionalfeatures-resource
Mar 14, 2026
Merged

Add Microsoft.Windows/OptionalFeatureList resource#1432
SteveL-MSFT merged 8 commits intoPowerShell:mainfrom
SteveL-MSFT:optionalfeatures-resource

Conversation

@SteveL-MSFT
Copy link
Member

PR Summary

Add Microsoft.Windows/OptionalFeatureList resource to manage Windows Optional Features.
Supports get, set, and export each requiring elevation
get and set require featureName to be present and exact match
get will return _exist=false when attempting to retrieve a non-existing feature
export allows featureName, displayName, description to have wildcard matching case-insensitive.
For export if multiple objects are used as input, each object's properties is a logical AND while each individual object is a logical OR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Windows-only DSC resource (Microsoft.Windows/OptionalFeatureList) implemented as a Rust executable (dism_dsc) that manages Windows Optional Features via the DISM API, with manifests/localization and Pester integration tests.

Changes:

  • Introduces the dism_dsc Rust crate with get, set, and export operations backed by DISM (dynamic loading + session wrapper).
  • Adds the DSC resource manifest + embedded JSON schema and localized strings.
  • Adds Pester tests for get/set/export, and wires the crate into the workspace (Cargo.toml/Cargo.lock).

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
resources/dism_dsc/src/main.rs CLI entrypoint + operation dispatch for get/set/export
resources/dism_dsc/src/optional_feature/mod.rs Optional feature module wiring/re-exports
resources/dism_dsc/src/optional_feature/types.rs Data model (feature list/info + enums) for JSON IO
resources/dism_dsc/src/optional_feature/dism.rs DISM dynamic loading + session + feature APIs
resources/dism_dsc/src/optional_feature/get.rs Implements resource get operation
resources/dism_dsc/src/optional_feature/set.rs Implements resource set operation + restart metadata
resources/dism_dsc/src/optional_feature/export.rs Implements resource export operation + wildcard filtering
resources/dism_dsc/optionalfeature.dsc.resource.json Resource manifest + embedded schema for OptionalFeatureList
resources/dism_dsc/locales/en-us.toml Localized messages for main/get/set/export/dism
resources/dism_dsc/Cargo.toml New crate definition and dependencies
resources/dism_dsc/.project.data.json Build/packaging metadata for the resource
resources/dism_dsc/tests/optionalFeature_get.tests.ps1 Pester tests for get behavior
resources/dism_dsc/tests/optionalFeature_set.tests.ps1 Pester tests for set behavior
resources/dism_dsc/tests/optionalFeature_export.tests.ps1 Pester tests for export behavior
Cargo.toml Adds resources/dism_dsc to workspace members/default-members and Windows group
Cargo.lock Adds lockfile entry for the new crate

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

SteveL-MSFT and others added 2 commits March 13, 2026 10:31
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Windows-only DSC resource (Microsoft.Windows/OptionalFeatureList) implemented by a new Rust binary (dism_dsc) that uses the DISM API to get, set, and export optional Windows features, including localized error messages and Pester tests.

Changes:

  • Introduces resources/dism_dsc Rust crate with DISM interop and handlers for get/set/export.
  • Adds the DSC resource manifest + embedded JSON schema for Microsoft.Windows/OptionalFeatureList.
  • Adds Pester tests for get, set, and export, and wires the crate into the workspace.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
resources/dism_dsc/tests/optionalFeature_set.tests.ps1 Adds Pester coverage for set behavior and validation errors.
resources/dism_dsc/tests/optionalFeature_get.tests.ps1 Adds Pester coverage for get, including _exist=false behavior.
resources/dism_dsc/tests/optionalFeature_export.tests.ps1 Adds Pester coverage for export filtering semantics.
resources/dism_dsc/src/optional_feature/types.rs Defines JSON (de)serializable types for features, states, and restart metadata.
resources/dism_dsc/src/optional_feature/set.rs Implements set via DISM enable/disable and returns updated state + restart metadata.
resources/dism_dsc/src/optional_feature/get.rs Implements get via DISM feature lookup.
resources/dism_dsc/src/optional_feature/export.rs Implements export with OR/AND filter semantics and wildcard matching.
resources/dism_dsc/src/optional_feature/dism.rs Implements dynamic loading + FFI bindings to dismapi.dll and session lifecycle.
resources/dism_dsc/src/optional_feature/mod.rs Exposes handlers for get/set/export.
resources/dism_dsc/src/main.rs CLI dispatcher with Windows gating and non-Windows fallback behavior.
resources/dism_dsc/optionalfeature.dsc.resource.json Adds the resource manifest and embedded schema for DSC.
resources/dism_dsc/locales/en-us.toml Adds localized strings for handler and DISM error messages.
resources/dism_dsc/Cargo.toml Declares the new Rust binary crate and dependencies.
resources/dism_dsc/.project.data.json Registers the resource project metadata and files to copy on Windows.
Cargo.toml Adds resources/dism_dsc to workspace members/default-members and Windows group.
Cargo.lock Locks the new dism_dsc package in the workspace.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

SteveL-MSFT and others added 2 commits March 13, 2026 15:41
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@SteveL-MSFT SteveL-MSFT marked this pull request as ready for review March 13, 2026 22:54
@SteveL-MSFT SteveL-MSFT merged commit 0f7ce97 into PowerShell:main Mar 14, 2026
19 checks passed
@SteveL-MSFT SteveL-MSFT deleted the optionalfeatures-resource branch March 14, 2026 03:19
@SteveL-MSFT SteveL-MSFT added Doc-Impact Schema-Impact Change requires updating a canonical schema for configs or manifests labels Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Doc-Impact Schema-Impact Change requires updating a canonical schema for configs or manifests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants