Skip to content

PowerShell agreements support - #6679

Open
JohnMcPMS wants to merge 9 commits into
microsoft:masterfrom
JohnMcPMS:agree-ps
Open

JohnMcPMS wants to merge 9 commits into
microsoft:masterfrom
JohnMcPMS:agree-ps

Conversation

@JohnMcPMS

@JohnMcPMS JohnMcPMS commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

📖 Description

Add agreement handling to PowerShell cmdlets. This is similar to the changes in #6612 for the MCP server but with a goal to be more backward compatible to maintain functionality for existing PowerShell usage. After sufficient warning time with the deprecation, that will be removed and automation will require the agreement option.

In interactive use, and without the option supplied, the user will be prompted for a response.

🔍 Validation

New and updated Pester tests for module and resources.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS
JohnMcPMS requested a review from a team as a code owner November 12, 2026 23:57
@github-actions

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Repair can accept unseen terms by displaying agreements for a different version or source than it actually uses, while unnecessary remote-agreement checks can block otherwise local repairs.

4 open issues
1 file not reviewed
  • src/PowerShell/Microsoft.WinGet.Client.Engine/Properties/Resources.Designer.cs: Generated file
What changed in this PR

Adds source and package agreement handling to WinGet’s PowerShell modules, building on the source agreement support introduced in #6612. Interactive users are prompted, while non-interactive use temporarily retains automatic acceptance with deprecation warnings.

Changes:

  • Adds agreement switches, consent handling, localized messages, and DSC integration.
  • Documents the new behavior and adds Pester coverage and an agreement-specific test package.
  • Updates test pipeline inputs and enables warnings-as-errors across all configurations in four PowerShell projects.
File Description
templates/​jobs-powershell-module.yml Supplies static test files to both PowerShell test jobs.
src/​PowerShell/​tests/​RunTests.ps1 Passes the static-file root into client tests.
src/​PowerShell/​tests/​Microsoft.WinGet.DSC.Tests.ps1 Tests DSC installation of a package with agreements.
src/​PowerShell/​tests/​Microsoft.WinGet.Client.Tests.ps1 Adds package and source agreement scenarios.
src/​PowerShell/​Microsoft.WinGet.DSC/​Microsoft.WinGet.DSC.psm1 Adds the default-enabled AcceptAgreements property.
src/​PowerShell/​Microsoft.WinGet.Configuration.Engine/​Microsoft.WinGet.Configuration.Engine.csproj Enables warnings-as-errors for every configuration.
src/​PowerShell/​Microsoft.WinGet.Configuration.Cmdlets/​Microsoft.WinGet.Configuration.Cmdlets.csproj Enables warnings-as-errors for every configuration.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Properties/​Resources.resx Adds agreement prompts, warnings, and errors.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Properties/​Resources.Designer.cs Exposes the new resource strings.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Microsoft.WinGet.Client.Engine.csproj Enables warnings-as-errors for every configuration.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Helpers/​AgreementConsent.cs Centralizes agreement formatting and consent decisions.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Exceptions/​PackageAgreementsUnavailableException.cs Reports unreadable package agreements.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Exceptions/​PackageAgreementsNotAcceptedException.cs Reports declined package agreements.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Exceptions/​NoSourcesAvailableException.cs Reports exclusion of all usable sources.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Commands/​RepairPackageCommand.cs Adds agreement handling before repair.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Commands/​InstallerPackageCommand.cs Requests consent before installation and updates.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Commands/​DownloadCommand.cs Requests consent before downloading packages.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Commands/​Common/​PackageCommand.cs Adds shared package agreement retrieval and consent.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Commands/​Common/​InstallCommand.cs Enables native agreement acceptance after consent.
src/​PowerShell/​Microsoft.WinGet.Client.Engine/​Commands/​Common/​FinderCommand.cs Handles source consent, persistence, and exclusion.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Microsoft.WinGet.Client.Cmdlets.csproj Enables warnings-as-errors for every configuration.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​UpdatePackageCmdlet.cs Forwards agreement switches to update operations.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​UninstallPackageCmdlet.cs Forwards source agreement acceptance.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​RepairPackageCmdlet.cs Exposes and forwards repair agreement options.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​InstallPackageCmdlet.cs Forwards agreement switches to installation.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​InstallerSelectionCmdlet.cs Exposes the shared package agreement switch.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​GetPackageCmdlet.cs Forwards source agreement acceptance.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​FindPackageCmdlet.cs Forwards source agreement acceptance.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​ExportPackageCmdlet.cs Forwards agreement switches to downloads.
src/​PowerShell/​Microsoft.WinGet.Client.Cmdlets/​Cmdlets/​Common/​FinderCmdlet.cs Exposes the source agreement switch.
src/​PowerShell/​Help/​Microsoft.WinGet.Client/​Update-WinGetPackage.md Documents update agreement switches.
src/​PowerShell/​Help/​Microsoft.WinGet.Client/​Uninstall-WinGetPackage.md Documents source agreement handling during uninstall.
src/​PowerShell/​Help/​Microsoft.WinGet.Client/​Repair-WinGetPackage.md Documents repair agreement switches.
src/​PowerShell/​Help/​Microsoft.WinGet.Client/​Install-WinGetPackage.md Documents installation agreement switches.
src/​PowerShell/​Help/​Microsoft.WinGet.Client/​Get-WinGetPackage.md Documents source consent for installed-package queries.
src/​PowerShell/​Help/​Microsoft.WinGet.Client/​Find-WinGetPackage.md Documents source consent for searches.
src/​PowerShell/​Help/​Microsoft.WinGet.Client/​Export-WinGetPackage.md Documents download agreement switches.
src/​PowerShell/​CommonFiles/​PowerShellCmdlet.cs Adds host-aware confirmation on the PowerShell thread.
src/​AppInstallerCLIE2ETests/​TestData/​Manifests/​TestExeInstaller_PackageAgreements.yaml Adds an isolated package agreement test fixture.
doc/​release-notes/​1.31/​powershell-agreement-consent.md Describes consent behavior and automation deprecations.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants