microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.29k stars 1.45k forks source link

WinGet not listing packages as installed #3674

Open Smith8154 opened 1 year ago

Smith8154 commented 1 year ago

Brief description of your issue

I have an internal WinGet repository where I have uploaded several of our internal applications that I push out to our internal machines. After pushing out certain installers (mainly installers from SAP), they do not show up in a WinGet export as being installed, even though they are. If I run winget list, it tells me the application is installed. I have matched all parameters of the application from what WinGet shows with the package I am pushing out, but it is still not being detected. This seems to be more of an issue with applications that do not install with a proper GUID. For example, SAP GUI installs with a GUID of "SAPGUI".

Steps to reproduce

Create a custom WinGet package of a problematic installer. Install the application using WinGet. Export list of installed packages.

Expected behavior

When an application is installed from WinGet, it should be listed in an export of installed packages.

Actual behavior

When an application is installed from WinGet, it is not being listed in an export of installed packages.

Environment

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

Windows: Windows.Desktop v10.0.19045.3448
System Architecture: X64
Smith8154 commented 1 year ago

Here are the details of the package I am pushing out: Package Name: SAP GUI for Windows Package Version: 8.00 Compilation 1 Publisher: SAP SE Package ID: CompanyName.SAPGUI

Here is what WinGet sees:

Finding available package from installed package using system reference search: Query:[none] Include:ProductCode='sapgui'[Exact] Include:NormalizedNameAndPublisher='sapguiforwindows'+'sapse'[Exact] Include:NormalizedNameAndPublisher='sapguiforwindows(x86)'+'sapse'[Exact]

Later in the log file:

[CLI ] No available version of package [SAP GUI for Windows 8.00 32bit  (Patch 3)] was found to export
Trenly commented 1 year ago

I don't have any way to see the actual data of the application that is installed, but WinGet is a bit particular in the data itself. Specifically, because winget uses the registry to determine which applications are installed, the values from the registry are what should be used as the package details. These are the same values shown in control panel, with Package name dropping items in parentheses.

So, if control panel shows the package as SAP GUI for Windows (x86) then the Package name should be SAP GUI for Windows. If control panel shows the version as 8000.0.7081.3396 then the Package Version should be 8000.0.7081.3396. If control panel shows the publisher as SAP SE, then the Publisher should be the same. You also mentioned the "GUID" is SAPGUI - this can be set as the Product Code in the package details, which should also improve matching

denelon commented 1 year ago

@Smith8154 is this additional source a REST based source?

Smith8154 commented 1 year ago

@Trenly Which registry location should I be looking at? I would guess HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\SAPGUI, but just want to make sure. Control Panel and the above registry location lists the version as 8.00 Compilation 1, which is what I have my version set to. Here are all of the details for SAP at the mentioned registry location:

"SapCreateKey"=dword:00000000
"DisplayName"="SAP GUI for Windows 8.00 32bit  (Patch 3)"
"DisplayVersion"="8.00 Compilation 1"
"DisplayIcon"="\"C:\\Program Files (x86)\\SAP\\FrontEnd\\sapgui\\saplgpad.exe\",0"
"Publisher"="SAP SE"
"URLUpdateInfo"="http://support.sap.com"
"ModifyPath"="\"C:\\Program Files (x86)\\SAP\\SAPsetup\\setup\\NwSapSetup.exe\""
"UninstallString"="\"C:\\Program Files (x86)\\SAP\\SAPsetup\\setup\\NwSapSetup.exe\" /uninstall /product=\"PdfPrintGui+SCRIPTED+SCE+SAPDTS+KW+GUIISHMED+JNet+CALSYNC+RFC64+SAPGUI\" /TitleComponent:\"SAPGUI\" /IgnoreMissingProducts"

@denelon I believe so. How would I confirm that? The source is added automatically on these machines.

denelon commented 1 year ago

You can run winget source export and look to see if the type is something like Microsoft.REST.

Trenly commented 1 year ago

@Trenly Which registry location should I be looking at? I would guess HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\SAPGUI, but just want to make sure. Control Panel and the above registry location lists the version as 8.00 Compilation 1, which is what I have my version set to. Here are all of the details for SAP at the mentioned registry location:

"SapCreateKey"=dword:00000000
"DisplayName"="SAP GUI for Windows 8.00 32bit  (Patch 3)"
"DisplayVersion"="8.00 Compilation 1"
"DisplayIcon"="\"C:\\Program Files (x86)\\SAP\\FrontEnd\\sapgui\\saplgpad.exe\",0"
"Publisher"="SAP SE"
"URLUpdateInfo"="http://support.sap.com"
"ModifyPath"="\"C:\\Program Files (x86)\\SAP\\SAPsetup\\setup\\NwSapSetup.exe\""
"UninstallString"="\"C:\\Program Files (x86)\\SAP\\SAPsetup\\setup\\NwSapSetup.exe\" /uninstall /product=\"PdfPrintGui+SCRIPTED+SCE+SAPDTS+KW+GUIISHMED+JNet+CALSYNC+RFC64+SAPGUI\" /TitleComponent:\"SAPGUI\" /IgnoreMissingProducts"

Based on that, I don't see any issues with the package details that you're pushing out

Smith8154 commented 1 year ago

Yeah, I am matching exactly what is being shown in the registry, but for some reason it is still not detecting that the package is installed.

@denelon Yes, it is a REST source.

denelon commented 1 year ago

Can you share the manifest? Feel free to strike out the installer URL or any other private URL details or description info. I'm specifically looking for the installer metadata content.

Smith8154 commented 1 year ago
{
    "PackageIdentifier": "Company.SAPGUI",
    "id": "Company.SAPGUI",
    "Versions": [
        {
            "PackageVersion": "'8.00 Compilation 1'",
            "Channel": null,
            "DefaultLocale": {
                "Moniker": null,
                "PackageLocale": "en-US",
                "Publisher": "SAP SE",
                "PublisherUrl": null,
                "PublisherSupportUrl": null,
                "PrivacyUrl": null,
                "Author": null,
                "PackageName": "SAP GUI for Windows",
                "PackageUrl": null,
                "License": "Proprietary",
                "LicenseUrl": null,
                "Copyright": null,
                "CopyrightUrl": null,
                "ShortDescription": "SAP GUI",
                "Description": null,
                "ReleaseNotes": null,
                "ReleaseNotesUrl": null,
                "Agreements": null,
                "Tags": null,
                "PurchaseUrl": null,
                "InstallationNotes": null,
                "Documentations": null
            },
            "Installers": [
                {
                    "InstallerIdentifier": "bc429c90-f1fa-434f-b5b7-10a91b3d63eb",
                    "InstallerSha256": "9c56f0badee3c921721fdca9a5dda780646c9190defb34956184c237384fd96e",
                    "InstallerUrl": "https://internalInstallerURL.com",
                    "Architecture": "x86",
                    "InstallerLocale": "en-US",
                    "Platform": null,
                    "MinimumOsVersion": null,
                    "InstallerType": "exe",
                    "Scope": "machine",
                    "SignatureSha256": null,
                    "InstallModes": [
                        "silent"
                    ],
                    "InstallerSwitches": {
                        "Silent": "/silent",
                        "SilentWithProgress": null,
                        "Interactive": null,
                        "InstallLocation": null,
                        "Log": null,
                        "Upgrade": null,
                        "Custom": "/package=\"CompanySAPGUI8.032bit\""
                    },
                    "InstallerSuccessCodes": null,
                    "ExpectedReturnCodes": null,
                    "UpgradeBehavior": null,
                    "Commands": null,
                    "Protocols": null,
                    "FileExtensions": null,
                    "Dependencies": null,
                    "PackageFamilyName": null,
                    "ProductCode": null,
                    "Capabilities": null,
                    "RestrictedCapabilities": null,
                    "MSStoreProductIdentifier": null,
                    "InstallerAbortsTerminal": false,
                    "ReleaseDate": "0001-01-01T00:00:00",
                    "InstallLocationRequired": false,
                    "RequireExplicitUpgrade": false,
                    "ElevationRequirement": null,
                    "UnsupportedOSArchitectures": null,
                    "AppsAndFeaturesEntries": null,
                    "Markets": null,
                    "NestedInstallerType": null,
                    "NestedInstallerFiles": null,
                    "DisplayInstallWarnings": false,
                    "UnsupportedArguments": null,
                    "InstallationMetadata": null
                }
            ],
            "Locales": null
        }
    ],
    "_rid": "rT0nAOBsOkEGAAAAAAAAAA==",
    "_self": "dbs/rT0nAA==/colls/rT0nAOBsOkE=/docs/rT0nAOBsOkEGAAAAAAAAAA==/",
    "_etag": "\"33014ff4-0000-0200-0000-651316de0000\"",
    "_attachments": "attachments/",
    "_ts": 1695749854
}

From the portal I upload the package from, I had to add the single quotes around the version. Without that, it was placing each word in its own single quote when running the installer on the machine, so instead of being '8.00 Compilation 1' it was '8.00' 'Compilation' '1'. I opened a ticket with the vendor (Nerdio) for that issue.

denelon commented 1 year ago

Can you share the output from WinGet list so I can see how that entry is displayed when it's installed?

Smith8154 commented 1 year ago

We have a lot of packages installed, so I removed all of the non-SAP packages from the output.

Name                                                        Id                                                          Version             Available     Source
----------------------------------------------------------------------------------------------------------------------------------------------------------------
64Bit RFC Controls                                          64Bit RFC Controls                                          8.00
SAP HANA Studio 64bit                                       HDBSTUDIO                                                   2.3.74.000000
Adobe LiveCycle Designer 11.0 for SAP solutions             SAP Adobe LiveCycle Designer 11.0                           11.0 Patch Level 25
SAP Interactive Excel                                       SAP Interactive Excel                                       3.0.8.22137
SAP Lumira Designer                                         SAP Lumira Designer                                         24.0.2
SAP Active Components Framework                             SAPACF                                                      Unknown
SAP Active Components Framework for Adobe                   SAPACF_ADOBE                                                Unknown
SAP Business Explorer                                       SAPBI                                                       8.00
SAP Analysis for Microsoft Office (64 Bit)                  SAPExcelAddInx64                                            2.8.1901.976
SAP GUI for Windows 8.00 32bit  (Patch 3)                   SAPGUI                                                      8.00 Compilation 1
SAP PDFPRINT for SAP GUI 8.00                               SAPPdfPrintGUI                                              Unknown
SAP Business Client 8.00                                    SAP_NWBC800                                                 8.00 PL0
SAP MMC SnapIn                                              {3CE839E7-AF8F-4B38-B051-301A8E5B4B8B}                      7.77.30120
denelon commented 1 year ago

If you winget search SAPGUI do you get a result?

What does it show with winget show Company.SAPGUI?

Smith8154 commented 1 year ago

Output from winget search SAPGUI:

Name                Id          Version              Source
------------------------------------------------------------
SAP GUI for Windows Company.SAPGUI '8.00 Compilation 1' Company

Output from winget show Company.SAPGUI:

Found SAP GUI for Windows [Company.SAPGUI]
Version: '8.00 Compilation 1'
Publisher: SAP SE
Description: SAP GUI
License: Proprietary
Installer:
  Installer Type: exe
  Installer Locale: en-US
  Installer Url: https://internalInstallerURL.com
  Release Date: 0001-01-01T00:00:00
Smith8154 commented 1 year ago

@denelon Any other ideas or things I should look at?

denelon commented 1 year ago

I can think of a couple of things.

I'm wondering if "SAPGUI" is the product Code written out by the installer. That's the ID being displayed in winget list. You could try adding that as the product code in the manifest as one thing to try.

The other I'd suggest trying is adding the Apps and features entry for the display name to match "SAP GUI for Windows 8.00 32bit (Patch 3)" in the manifest.

We do have some logic to ignore things in parenthesis in the display name and I suspect the problem is in that area.

Smith8154 commented 1 year ago

Still no luck. I also went into the registry and modified the package name and version to remove anything WinGet may not like, but that still didn't work. I changed the name to just be "SAP GUI for Windows" and changed the version number to "8.03" and made the same changes in my WinGet repository, but it is still not detecting the application.

denelon commented 1 year ago

That is really strange. I've tested several times with an internal instance of the REST source and results routinely matched. Is it just this package or is it every package from the source?

denelon commented 1 year ago

Did you include the extra space(s) after the "32bit" and the "(Patch 3)"? We had something strange in the past with a non-standard character in the display name.

denelon commented 1 year ago

Another random idea...

You could try creating a new manifest for the package with wingetcreate and see if it complains or exposes any unexpected metadata.

Smith8154 commented 1 year ago

Only specific packages from the source. Most of them are fine, but I currently have 5 applications (all SAP applications) that are not working.

I did try including the extra spaces (copied and pasted the values from regedit directly into our WinGet package).

I created a new manifest and the name was the only thing that was different. The manifest says the name is "SAP Front-End Setup for the Windows(R) Environment". I entered that into our existing package minus the parenthesis, but that didn't work either.

Is it possible that because this installer packages contain multiple applications, that there would be an issue with that? The SAP GUI installer puts several applications onto the machine, not just one.

denelon commented 1 year ago

That could cause some of the problems with the "matching" logic.

Smith8154 commented 1 year ago

Is there anything that could be done to help with that? Or would it require a new feature to add something that could be customized to tell WinGet what it should be looking for after an install to confirm the program exists?

Trenly commented 1 year ago

Is there anything that could be done to help with that? Or would it require a new feature to add something that could be customized to tell WinGet what it should be looking for after an install to confirm the program exists?

You could try adding an AppsAndFeaturesEntries exactly specifying the DisplayName, DisplayVersion, Publisher, and ProductCode of the primary package it installs

Smith8154 commented 1 year ago

@Trenly I think you are on to something. I went through wingetcreate again and added the AppsAndFeaturesEntries. wingetcreate gives me a YAML file, but my repository only accepts JSON files. Unfortunately, I am stupid and do not know how I would go about converting this to the format that would be accepted by the JSON. Any assistance you could provide would be much appreciated. Below is the relevant part of the YAML file that I would need to be in JSON.

AppsAndFeaturesEntries:
- DisplayName: SAP GUI for Windows 8.00 32bit  (Patch 3)
  Publisher: SAP SE
  DisplayVersion: 8.00 Compilation 1
- DisplayName: SAP Business Client 8.00
  Publisher: SAP SE
  DisplayVersion: 8.00 PL0
- DisplayName: SAP PDFPRINT for SAP GUI 8.00
  Publisher: SAP SE
- DisplayName: SAP Business Explorer
  Publisher: SAP SE
  DisplayVersion: "8.00"
- DisplayName: 64Bit RFC Controls
  Publisher: SAP SE
  DisplayVersion: "8.00"
Trenly commented 1 year ago

@Trenly I think you are on to something. I went through wingetcreate again and added the AppsAndFeaturesEntries. wingetcreate gives me a YAML file, but my repository only accepts JSON files. Unfortunately, I am stupid and do not know how I would go about converting this to the format that would be accepted by the JSON. Any assistance you could provide would be much appreciated. Below is the relevant part of the YAML file that I would need to be in JSON.

So, there is a quirk in WinGet where including multiple AppsAndFeaturesEntries causes some weird behavior, so I'd stick to just the primary one.

AppsAndFeaturesEntries:
  - DisplayName: SAP GUI for Windows 8.00 32bit  (Patch 3)
    Publisher: SAP SE
    DisplayVersion: 8.00 Compilation 1

Converting this to JSON would look something like -

"AppsAndFeaturesEntries":  [
  {
    "DisplayName":  "SAP GUI for Windows 8.00 32bit  (Patch 3)",
    "Publisher":  "SAP SE",
    "DisplayVersion":  "8.00 Compilation 1"
  }
]
Smith8154 commented 1 year ago

I added that, but it is still not detecting the package as being installed. I was really hoping that would get it...

mdanish-kh commented 3 months ago

I went through wingetcreate again and added the AppsAndFeaturesEntries. wingetcreate gives me a YAML file, but my repository only accepts JSON files.

@Smith8154 FYI, with the release of version v1.6.4.0, wingetcreate supports creating JSON manifests. You can pass --format json when creating a manifest, or set it as the default output format using wingetcreate settings