Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair-WinGetPackageManager outputs noise in PowerShell transcripts #4005

Open
janegilring opened this issue Dec 22, 2023 · 0 comments
Open
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. PowerShell Issue related to WinGet PowerShell Module or cmdlet
Milestone

Comments

@janegilring
Copy link

janegilring commented Dec 22, 2023

Brief description of your issue

The log file for the WinGet bootstrapping outputs the following:
The term 'winget' is not recognized as a name of a cmdlet, function, script file, or executable program.

This happens even though we don`t call winget.exe directly in the bootstrapping-script, we just run Repair-WinGetPackageManager to install WinGet.

Simple repro on a fresh 2022 VM:
image

I suspect this is due to some internal workings of Repair-WinGetPackageManager checking for the existence of winget before installing it if not present.

I`m not too familiar with C# - but seems like the relevant parts are here
https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/WinGetPackageManagerCommand.cs#L91
and here
https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Microsoft.WinGet.Client.Engine/Common/WinGetIntegrity.cs#L98

Suggestions for possible solutions:

  • Add a -Force switch to Repair-WinGetPackageManager to make it skip checking existence of winget.exe
  • Add a separate Install-WinGetPackageManager which can be used for bootstrapping scenarios
  • Suppress the output of the presence of winget.exe

Steps to reproduce

On a machine which does not have WinGet installed, open PowerShell 7 and run the following:

Start-Transcript
Install-Module -Name Microsoft.WinGet.Client
$null = Repair-WinGetPackageManager -AllUsers
Stop-Transcript

Expected behavior

Repair-WinGetPackageManager should not output the following to the PowerShell transcript log file:
`The term 'winget' is not recognized as a name of a cmdlet, function, script file, or executable program.

Actual behavior

Repair-WinGetPackageManager outputs the following to the PowerShell transcript log file:
`The term 'winget' is not recognized as a name of a cmdlet, function, script file, or executable program.

Environment

Windows Package Manager v1.6.3421
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Server v10.0.20348.2159
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3421.0
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Dec 22, 2023
@stephengillie stephengillie added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage Issue need to be triaged labels Dec 22, 2023
@denelon denelon added the PowerShell Issue related to WinGet PowerShell Module or cmdlet label Dec 22, 2023
@denelon denelon added this to the 1.8 Client milestone Jan 30, 2024
@denelon denelon modified the milestones: 1.8 Client, 1.9 Client Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. PowerShell Issue related to WinGet PowerShell Module or cmdlet
Projects
None yet
Development

No branches or pull requests

3 participants