Skip to content

Install Apps with Winget using Intune

Description

This guide shows you how to use Windows Package Manager (Winget) to streamline application deployment through Intune Win32 applications, eliminating the need for traditional application packaging. You'll learn how to:

  1. 🚀 Set up the deployment
  2. 📦 Use Winget commands to identify correct package information
  3. 📱 Creating the Win32 Intune App
  4. 💾 Configure install and uninstall commands
  5. 👮 Implement reliable detection methods

While somewhat maintaining the ease of installation, this approach provides a more budget-friendly alternative to enterprise app management. Perfect for IT administrators looking to modernise their application deployment workflow.

1. 🚀 Set up the deployment

  1. Go to the Microsoft GitHub Page (Microsoft-Win32-Content-Prep-Tool) and dowload the 'IntuneWinAppUtil.exe' or download it here directly: Download.
  2. Unpack the downloaded zip file.
  3. In the unpacked folder create another folder called 'App'.
  4. In the new folder create a text file.
  5. Open a Powershell window and navigate to the folder where you extracted the downloaded files and run the 'IntuneWinAppUtil.exe'.
  6. You will now be asked to specify a source folder, a setup file, an output folder and whether you want to use a catalog folder.
drawing
  1. This will take a second to complete.
drawing

2. 📦 Use Winget commands to identify correct package information

  1. Now open a powershell window to find the package id of the application you want to install.
powershell
winget search 1password
drawing

3. 📱 Creating the Win32 Intune App

  1. Open the Intune admin center.
  2. Navigate to 'Apps' -> 'All apps' -> and click 'Add'.
  3. Select the 'App type': 'Windows app (Win32)'.
  4. Now click 'Select app package file' and select the .intunewin file you created in the first step.
drawing
  1. Next, enter the name of the application and any additional information you need.
drawing

4. 💾 Configure install and uninstall commands

  1. The following tab 'Program' allows you to enter the installation and uninstallation commands.

Install command:

powershell
Powershell.exe -NoProfile -NonInteractive -WindowStyle "Hidden"  -ExecutionPolicy "ByPass" -Command {winget install agilebits.1password --source winget --accept-source-agreements --accept-package-agreements}

Uninstall command:

powershell
Powershell.exe -NoProfile -NonInteractive -WindowStyle "Hidden"  -ExecutionPolicy "ByPass" -Command {winget uninstall agilebits.1password --source winget --accept-source-agreements}

INFO

These commands start a non-interactive powershell window, hide it, bypass the execution policy, and install/uninstall the application with winget.

drawing
  1. In the next tab 'Requirements' you can set the 'Operating system architecture' (64-bit) and 'Minimum operating system' (for example 'Windows 10 21H1').

5. 👮 Implement reliable detection methods

  1. Now we come to the 'Detection rules' tab, select 'Use a custom detection script', copy the script below and upload it.
  2. Leave both options set to 'No'.

Detection Script:

powershell
$app = winget list "agilebits.1password" -e

If (!($app[$app.count-1] -eq "No installed package found matching input criteria.")) {
	Write-Host ("Found it!")
	exit 0
}
else {
	Write-Host ("Didn`t find it!")
	exit 1
}

INFO

This script checks if an application with this exact id is installed and if not, winget will display 'No installed package found matching input criteria.' in the last string of the output array. If the string is not found, the script exits with a '0', which means there is an application with the exact id (i.e. the application is installed), if the string is found, the script exits with a '1'.

  1. Next, you can skip the 'Dependencies' and 'Supersedence', and then assign the application to whomever you want.

6. Conclusion

This post demonstrates how to leverage Windows Package Manager (Winget) with Intune Win32 apps for simplified application deployment. It provides a step-by-step guide covering setup, package identification, Win32 app creation, installation commands, and detection methods.

Key Advantages

  • Eliminates need for traditional app packaging
  • No need to periodically update app packages
  • Streamlines deployment process
  • Maintains robust Intune management capabilities
  • Uses native Windows Package Manager
  • Requires minimal setup (just one .intunewin file for all apps)
  • Easy to maintain and add to
  • Keeps the same reporting and management capabilities as traditional Win32 apps

How to modify for another app

  1. Use the same .intunewin file - no need to create a new one
  2. Find the new app's package ID using: winget search [app name]
  3. Modify the install command:
powershell
Powershell.exe -NoProfile -NonInteractive -WindowStyle "Hidden"  -ExecutionPolicy "ByPass" -Command {winget install [new-package-id] --source winget --accept-source-agreements --accept-package-agreements}
  1. Modify the uninstall command:
powershell
Powershell.exe -NoProfile -NonInteractive -WindowStyle "Hidden"  -ExecutionPolicy "ByPass" -Command {winget uninstall [new-package-id] --source winget --accept-source-agreements}
  1. Update the detection script with the new package ID:
powershell
$app = winget list "[new-package-id]" -e

The rest of the configuration in Intune remains the same - just update the app name and description to match your new application.

Updating your apps

Updating applications through Winget offers a streamlined, efficient approach to application management. By leveraging a simple script (i.e. winget update --all) or Intune remediation scripts, IT administrators can automate the entire update process across their organization. This modern method eliminates the need for costly enterprise application management solutions or third-party tools, while significantly reducing the time spent on manual updates. The built-in capabilities of Winget handle all the heavy lifting, from checking for updates to deploying them seamlessly, making it an excellent choice for organizations looking to optimize their IT resources and maintain a current application landscape.