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

install-WinGetPackage reinstalling packages #3455

Open
kdpuvvadi opened this issue Jul 20, 2023 · 6 comments
Open

install-WinGetPackage reinstalling packages #3455

kdpuvvadi opened this issue Jul 20, 2023 · 6 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. PowerShell Issue related to WinGet PowerShell Module or cmdlet

Comments

@kdpuvvadi
Copy link

Brief description of your issue

install-WinGetPackage installing the package regardless installation status, update availability. I'm aware there that Update-WinGetPackage cmdlet is available but install cmdlet should also consider the installation status.

Steps to reproduce

I'm using npp as base here.

check application status

$ Get-Command notepad++

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     notepad++.exe                                      8.5.4.0    C:\Program Files\Notepad++\notepad++.exe

Try installing with winget client

$ winget install Notepad++.Notepad++
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.

try same with install-WinGetPackage

install-WinGetPackage Notepad++.Notepad++ -Verbose -Debug

Confirm
Are you sure you want to perform this action?
Performing the operation "Install-WinGetPackage" on target "Notepad++ [Notepad++.Notepad++] Version
 8.5.4".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A

InstallerError Code Status RebootRequired ExtendedErrorCode CorrelationData
-------------- ---- ------ -------------- ----------------- ---------------
0                  Ok     False

Expected behavior

Skip install if no update available

Actual behavior

Reinstalling the package

Environment

Windows Package Manager v1.5.1572

Windows: Windows.Desktop v10.0.19045.3208
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.1572.0
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Jul 20, 2023
@kdpuvvadi
Copy link
Author

cc @denelon, #221

@kdpuvvadi
Copy link
Author

tested this on both 1.5.1881 and 1.6.1573-preview

@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 Jul 20, 2023
@denelon denelon added the PowerShell Issue related to WinGet PowerShell Module or cmdlet label Jul 21, 2023
@jantari
Copy link

jantari commented Nov 23, 2023

This is definitely still an issue:

~\configs\Windows on  win-setup-admincoprocess
❯ winget install --source winget --id Google.Chrome --scope machine --silent
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.

~\configs\Windows on  win-setup-admincoprocess
❯ Install-WinGetPackage -Source winget -Id Google.Chrome -Scope System -Mode Silent -Verbose
VERBOSE: Performing the operation "Install-WinGetPackage" on target "Google Chrome [Google.Chrome] Version 119.0.6045.160".

InstallerErrorCode Status RebootRequired ExtendedErrorCode CorrelationData
------------------ ------ -------------- ----------------- ---------------
0                  Ok     False


~\configs\Windows on  win-setup-admincoprocess took 1m31s
❯ winget --version
v1.6.3133

~\configs\Windows on  win-setup-admincoprocess
❯ get-module  -Name Microsoft.Winget.Client

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.6.3133.0            Microsoft.Winget.Client             {Add-WinGetSource, Assert-WinGetPackageManager, Disable-WinGetSetting, Enable-WinGetSetting…}

Another, related problem is that Install-WinGetPackage does not have a parameter for the --no-upgrade option.

@jantari
Copy link

jantari commented Mar 13, 2024

Latest PowerShell module v1.7.10661, this is still an issue.

@kdpuvvadi
Copy link
Author

Tested this on 1.7.10861 and issue is still present

@kdpuvvadi
Copy link
Author

From the source it's seems just passing all the args to the winget client but trying with same args used with ps module with winget resulting in different result.

 if($Result.count -eq 1 -or $Local) {
            & "WinGet" $WinGetInstallArgs
            $Result = ""
        }

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

4 participants