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.27k stars 1.45k forks source link

Windows11 System context deployment via Intune (MEM) #2541

Open Matt-C22 opened 2 years ago

Matt-C22 commented 2 years ago

Brief description of your issue

When trying to deploy winget via DISM (cmdlet below) it works, however when trying to run via System (psexec even) it doesn't return recognize the executable (no list of commands returned) when launching from the following path: $env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"

winget system context install (works with v1.3.2091) on both W10 & W11: DISM.exe /online /Add-ProvisionedAppxPackage /PackagePath:"\..\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" /SkipLicense

I'm well aware that the normal installation of WinGet on W11 is located under the %LocalAppData% for the user. How are we supposed to deliver winget packages via System context over Intune?

Steps to reproduce

  1. Launch cmd.exe using and then switch to powershell psexec.exe -s -i cmd.exe
  2. Install release using DISM DISM.exe /online /Add-ProvisionedAppxPackage /PackagePath:"\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" /SkipLicense
  3. Browse to the WinGet system path : $ResolveWingetPath = Resolve-Path "$env:ProgramFiles\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" $WingetPath = $ResolveWingetPath[-1].Path
  4. Change directory using cd $wingetpath
  5. Try running .\winget.exe
  6. It wouldn't return anything as if the executable is broken. (Works perfectly fine for W10)

Expected behavior

Return the list of commands along with the summary about Winget CLI

Actual behavior

Returns nothing and System installs are broken.

Environment

Windows: Windows.Desktop v10.0.22000.978
System Architecture: X64
Trenly commented 2 years ago

Have you seen these?

Matt-C22 commented 2 years ago

Thanks @Trenly for dropping those. I've been through them actually during the past weeks, however I mentioned that it does work for W10 using System account by browsing to the %ProgramFiles% install path of winget, that gets added via DISM, since Add-AppxPackage is not available.

On W11 the executable simply doesn't budge when it's launched. It's not about winget not getting recognized in the system context as it does in the user one thanks to the PATH variable.

denelon commented 2 years ago

Also related: