Szukaj na tym blogu

wtorek, 6 sierpnia 2024

winget application installer

WinGet (App Installer) is already available in MS Store app (new) in Intune. Somehow you cannot find it by name but by ID: 9NBLGGH4NNS1 (this ID can be retrieved from copy link as shown below). So the whole paragraph nr 2 can be addressed easily now


To have any application installed via WinGet you should prepare Win32 app (intunewin). To do it create a separate folder on your machine, e.g.: Google.Chrome. Create there 2 powershell scripts:

  1. Google.Chrome.ps1

$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe"

    if ($ResolveWingetPath){

           $WingetPath = $ResolveWingetPath[-1].Path

    }

$Wingetpath = Split-Path -Path $WingetPath -Parent

cd $wingetpath

.\winget.exe install --exact --id Google.Chrome --silent --accept-package-agreements --accept-source-agreements

 

  1. uninstall_Google.Chrome.ps1

$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe\winget.exe"

    if ($ResolveWingetPath){

           $WingetPath = $ResolveWingetPath[-1].Path

    }

$Wingetpath = Split-Path -Path $WingetPath -Parent

cd $wingetpath

.\winget.exe uninstall --exact --id Google.Chrome --silent

 

Looking at the above script, you will notice that the first part is to resolve the DesktopAppInstaller path. Because the Winget command is normally not recognized in the system context.

 

To create intunewin file which can be uploaded to Intune as source of win32 app follow: https://learn.microsoft.com/en-us/mem/intune/apps/apps-win32-prepare

Basically run IntuneWinAppUtil.exe and provide details like below:

A screenshot of a computer screen

Description automatically generated


Then in C:\temp there will be Google.Chrome.intunewin

 

As a next step open Intune console ang go to Apps > Windows. Then click Add button and choose: Windows app (win32)

A screenshot of a computer

Description automatically generated

In next step click on Select app package file and provide intunewin file path

A screenshot of a computer screen

Description automatically generated

In next step provide Name of application in the convention of winget e.g. Google.Chrome or Adobe.Acrobat.Reader.64-bit. You can use: winget search adobe to search winget repository and find out application name.

Edit description and put info that this app is using winget for installation.

In App version field put: newest.

Then click next. On next step fill out like below:

A screenshot of a computer

Description automatically generated

On next step (Requirements) fill out first 2 only.

On Detection rules step configure like below:

A screenshot of a computer

Description automatically generated

Brak komentarzy:

Prześlij komentarz