SorenLundt / WinGet-Wrapper

PowerShell Scripts to bulk import WinGet packages to InTune including all package metadata.
GNU General Public License v3.0
80 stars 12 forks source link
intune intunewin intunewin32app package package-manager powershell windows winget winget-pkgs

WinGet-Wrapper

PowerShell Scripts to deploy and bulk import WinGet packages to InTune including metadata.
Automatically detect latest version using dynamic detection script.
Detection script checks local installed version against latest winget available version or a defined fixed target version.
Bulk import WinGet packages to InTune including WinGet package metadata using WinGet-WrapperImportGUI.exe

Background / Why?

WinGet have a few limitations in terms of automation and is not integrated with common endpoints management products.
System Context is not possible by using "winget" as the .exe location must be found and this location is not static due to versioning in the directory name.

Requirements

Windows 10 20H2 or newer
Powershell 5.1
Client language must be en-US, as Winget-Wrapper parses only English output.
Module "IntuneWin32App" and "Microsoft.Graph.Intune" needed for import to InTune

WinGet-WrapperImportGUI.exe

WinGet-WrapperImportGUI is a graphical interface designed to streamline the import of WinGet packages into InTune.
This tool complements WinGet-Wrapper, providing an intuitive way to upload WinGet packages to InTune, along with their metadata.

Features:

image

Usage:

Open the GUI: Run WinGet-WrapperImportGUI.exe to open the GUI
Search Packages: Enter your search query and click "Search" to find WinGet packages.
Select Packages: Select from search results, then click the center arrow to move them to the import list.
Import to InTune: Enter your Tenant ID and click "Import to InTune" to import selected packages.
Additional Actions: Use buttons for exporting CSV, deleting, or importing from CSV.

If you get errors when using the ImportGUI, you may need to unblock winget-wrapper files from file properties.
WinGet-WrapperImportFromCSV.ps1, IntuneWinAppUtil.exe, WinGet-WrapperImportGUI.ps1, more.. image

WinGet-Wrapper.ps1

image

Usage:

Powershell.exe -NoLogo -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File WinGet-Wrapper.ps1 -PackageName "PackageName for log file" -StopProcess "kill process using Stop-Process (do not add .exe)" -PreScript "somefile.ps1" -PostScript "somefile.ps1" -ArgumentList "Arguments Passed to WinGet.exe"

WinGet-WrapperDetection.ps1

Matches locally installed version with newest available version using WinGet or specified version using $TargetVersion
Can be setup to accept newer installed version locally $AcceptNewerVersion

image

WinGet-WrapperRequirements.ps1

Checks if application is detected locally. If not detected will not attempt update/install
To be used when only wanting to update if application is already installed. (Update Only)

image

Outputs either "Installed" or "Not Installed"

image

WinGet-WrapperImportFromCSV.ps1

Imports packages from WinGet to InTune (incuding available WinGet package metadata)
Package content is stored under Packages\Package.ID-Context-UpdateOnly-UserName-yyyy-mm-dd-hhssmm
Create deployment using csv columns: InstallIntent, Notification, GroupID

image

Usage: Import from CSV (InTune)

Open the sample CSV file WinGet-WrapperImportFromCSV.csv and add any WinGet Package IDs to import (Case Sensitive)

Usage:

WinGet-WrapperImportFromCSV.ps1 -TenantID company.onmicrosoft.com -csvFile WinGet-WrapperImportFromCSV.csv -SkipConfirmation

Process:

image

Results:

image

Columns:

Usage: Manual Import (InTune)

Application Installation

In InTune create an Windows app (Win32) and upload WinGet-Wrapper.InTuneWin as the package file.

Install: Powershell.exe -NoLogo -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File WinGet-Wrapper.ps1 -PackageName "VideoLAN.VLC" -StopProcess "VLC" -ArgumentList "install --exact --id VideoLAN.VLC --silent --accept-package-agreements --accept-source-agreements --scope machine"

Uninstall: Powershell.exe -NoLogo -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File WinGet-Wrapper.ps1 -PackageName "VideoLAN.VLC" -StopProcess "VLC" -ArgumentList "Uninstall --exact --id VideoLAN.VLC --silent --accept-source-agreements --scope machine"

Change the $id variable to match the package id in the detection script and upload it ($id = "VideoLAN.VLC")
If specific version is required change the $TargetVersion (Ex. $TargetVersion = "1.0.0.0")

image

Application Update Only

For creating application that will only update/install if application is already installed
Perform the same steps as in "Application Installation".
Setup Requirement rule script with return string value of "Installed"

image

image

Disclaimer

This software is provided "AS IS" with no warranties. Use at your own risk.