Add Microsoft.Windows/OptionalFeatureList resource#1432
Add Microsoft.Windows/OptionalFeatureList resource#1432SteveL-MSFT merged 8 commits intoPowerShell:mainfrom
Microsoft.Windows/OptionalFeatureList resource#1432Conversation
There was a problem hiding this comment.
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_dscRust crate withget,set, andexportoperations 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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_dscRust crate with DISM interop and handlers forget/set/export. - Adds the DSC resource manifest + embedded JSON schema for
Microsoft.Windows/OptionalFeatureList. - Adds Pester tests for
get,set, andexport, 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
PR Summary
Add
Microsoft.Windows/OptionalFeatureListresource to manage Windows Optional Features.Supports
get,set, andexporteach requiring elevationgetandsetrequirefeatureNameto be present and exact matchgetwill return_exist=falsewhen attempting to retrieve a non-existing featureexportallowsfeatureName,displayName,descriptionto have wildcard matching case-insensitive.For
exportif multiple objects are used as input, each object's properties is a logical AND while each individual object is a logical OR