Skip to content

Conversation

@adityapatwardhan
Copy link
Member

@adityapatwardhan adityapatwardhan commented Oct 7, 2025

PR Summary

This pull request introduces a new DSC v3 resource for managing PowerShell profiles across platforms, and integrates it as an experimental feature. The changes include adding resource and script files, updating build configurations to include these files, and modifying workflows to fetch the latest DSC package for CI. The most important changes are grouped below:

PowerShell Profile DSC Resource Implementation:

  • Added new resource manifest (pwsh.profile.dsc.resource.json) and implementation script (pwsh.profile.resource.ps1) to enable management of PowerShell profiles via DSC v3. The resource supports operations to get, set, and export profile content for different profile types. [1] [2]

Experimental Feature Registration:

  • Registered the new resource as an experimental feature PSProfileDSCResource in both configuration files (experimental-feature-linux.json, experimental-feature-windows.json) and in the engine code (ExperimentalFeature.cs). [1] [2] [3]

Build and Packaging Updates:

  • Updated project files for both Unix (powershell-unix.csproj) and Windows (powershell-win-core.csproj) to include the new DSC resource files in the output and publish directories, ensuring they are shipped with builds. [1] [2]

CI Workflow Improvements:

  • Enhanced GitHub Actions workflows for Linux and Windows to dynamically fetch and extract the latest DSC package version, ensuring up-to-date DSC binaries are used during CI runs. [1] [2]

(References: [1] [2] [3] [4] [5] [6] [7] [8] [9]

PR Context

Export all profiles:

 dsc resource export --resource Microsoft.PowerShell/Profile

  PS D:\PSGit\PowerShell> dsc resource export --resource Microsoft.PowerShell/Profile
  $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
  contentVersion: 1.0.0
  resources:
  - type: Microsoft.PowerShell/Profile
    name: AllUsersCurrentHost
    properties:
      profileType: AllUsersCurrentHost
      content: "Write-Host 'Welcome to your PowerShell profile - AllUsersCurrentHost!'\r\n"
      _exist: true
  - type: Microsoft.PowerShell/Profile
    name: AllUsersAllHosts
    properties:
      profileType: AllUsersAllHosts
      content: "Write-Host 'Welcome to your PowerShell profile - AllUsersAllHosts!'\r\n"
      _exist: true
  - type: Microsoft.PowerShell/Profile
    name: CurrentUserAllHosts
    properties:
      profileType: CurrentUserAllHosts
      content: "# Test profile content currentuser allhosts\r\n"
      _exist: true
  - type: Microsoft.PowerShell/Profile
    name: CurrentUserCurrentHost
    properties:
      profileType: CurrentUserCurrentHost
      content: "Write-Host 'Welcome to your PowerShell profile - CurrentUserCurrentHost!'\r\n"
      _exist: true

Get current user all host

$i = @{ profileType = "CurrentUserAllHosts"} | ConvertTo-Json
dsc resource get --resource Microsoft.PowerShell/Profile -i $i
actualState:
  profileType: CurrentUserAllHosts
  content: '# Test profile content currentuser allhosts'

PR Checklist

@adityapatwardhan adityapatwardhan requested review from a team and jshigetomi as code owners October 7, 2025 19:54
@adityapatwardhan adityapatwardhan changed the title Dsc resource profile DSC v3 resource for Powershell Profile Oct 7, 2025
@adityapatwardhan adityapatwardhan marked this pull request as draft October 7, 2025 19:57
@microsoft-github-policy-service microsoft-github-policy-service bot added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Oct 7, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 11, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 23, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Oct 27, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 4, 2025
@adityapatwardhan adityapatwardhan force-pushed the DSCResourceProfile branch 2 times, most recently from 2cea1d3 to b962617 Compare November 5, 2025 19:56
@adityapatwardhan adityapatwardhan added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 5, 2025
@adityapatwardhan adityapatwardhan marked this pull request as ready for review November 5, 2025 22:36
Copilot AI review requested due to automatic review settings November 5, 2025 22:36
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

This PR adds a new DSC v3 resource for managing PowerShell profiles, introducing the PSProfileDSCResource experimental feature. The implementation includes resource scripts, test infrastructure, and build configuration changes to package the resource with PowerShell.

Key changes:

  • Adds DSC profile resource implementation (pwsh.profile.resource.ps1 and pwsh.profile.dsc.resource.json)
  • Introduces PSProfileDSCResource experimental feature
  • Updates BOM files for Windows, macOS, and Linux to include the new resource files
  • Adds comprehensive Pester tests and DSC configuration files for validation
  • Modifies test workflows to download and configure DSC v3 for testing

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
dsc/pwsh.profile.resource.ps1 Implements DSC resource operations (get, set, export) for PowerShell profile management
dsc/pwsh.profile.dsc.resource.json DSC v3 resource manifest defining schema and execution commands
test/powershell/dsc/dsc.profileresource.Tests.ps1 Pester tests validating DSC profile resource functionality
test/powershell/dsc/*.dsc.yaml DSC configuration files for testing different profile types
src/System.Management.Automation/engine/ExperimentalFeature/ExperimentalFeature.cs Adds PSProfileDSCResource experimental feature definition
experimental-feature-*.json Enables the experimental feature for Windows and Linux
src/powershell-win-core/powershell-win-core.csproj Configures DSC resource files to be copied to build output on Windows
src/powershell-unix/powershell-unix.csproj Configures DSC resource files to be copied to build output on Unix
tools/packaging/boms/*.json Updates packaging manifests to include DSC resource files
.github/actions/test/windows/action.yml Adds DSC v3 download and setup for Windows test workflows
.github/actions/test/nix/action.yml Adds DSC v3 download and setup for Linux/macOS test workflows

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

adityapatwardhan and others added 4 commits November 5, 2025 14:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@adityapatwardhan adityapatwardhan enabled auto-merge (squash) November 10, 2025 22:38
@adityapatwardhan adityapatwardhan merged commit 5715d33 into PowerShell:master Nov 13, 2025
46 of 48 checks passed
@adityapatwardhan adityapatwardhan deleted the DSCResourceProfile branch November 13, 2025 17:56
TravisEz13 pushed a commit to TravisEz13/PowerShell that referenced this pull request Nov 13, 2025
SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.6.x-Migrated CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants