Skip to content

PSGallery repository intermittently not registered on windows-2025 runners #13758

@wmmc88

Description

@wmmc88

Description

Install-Module with -Repository PSGallery intermittently fails on windows-2025 runners because the PSGallery repository is not registered:

Get-PackageSource: Unable to find repository 'PSGallery'. Use Get-PSRepository to see all available repositories.

This is transient — re-running the same workflow on a different runner succeeds. The PSGallery repository should be pre-registered on all Windows runner images, but occasionally a provisioned runner is missing it.

Workaround: Re-register PSGallery before use:

if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) {
    Register-PSRepository -Default
}
Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force

Platforms affected

  • GitHub Actions - Standard Runners

Runner images affected

  • Windows Server 2025

Image version and build link

Is it regression?

Unknown — this is an intermittent/transient failure. It does not reproduce on every run, only on certain provisioned runners.

Expected behavior

Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force succeeds because PSGallery is pre-registered on the runner image.

Actual behavior

The command fails with:

Get-PackageSource: Unable to find repository 'PSGallery'. Use Get-PSRepository to see all available repositories.
Process completed with exit code 1.

Repro steps

  1. Create a GitHub Actions workflow targeting runs-on: windows-2025
  2. Add a step: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
  3. Run the workflow repeatedly — eventually a runner will be provisioned without PSGallery registered

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions