35.5 C
Dubai
Tuesday, April 23, 2024

Use Winget to deploy apps on Intune.

The fast and best way to package & deploy applications in Intune,

No need to update the application often for new versions, Limit your application size & save time in application upload.

Winget documentation reference https://learn.microsoft.com/en-us/windows/package-manager/winget/

The winget command line tool enables users to discover, install, upgrade, remove and configure applications on Windows 10 and Windows 11 computers. This tool is the client interface to the Windows Package Manager service.

Note: The winget command line tool is only supported on Windows 10 1709 (build 16299) or later. The scrips on this document are reusable by changing the application ID.

Finding Application ID

Use winget search followed by the application name to find the application ID. In this example, Finding the Application ID for Pycharm.

Open powershell as an administrator

winget search pycharm

Create installation script.

Create a PowerShell file and add this command.

Note: Not all installers support installing in “user” scope and “machine” scope consistently.  “–scope=user” refers to the application installation directory, path C:\Users\JohnS\AppData\Roaming\JetBrains\PyCharm2023.3.  

winget install -e --id JetBrains.PyCharm.Community --silent --accept-package-agreements --accept-source-agreements

Create uninstallation script.

Create a PowerShell file and add this command.

winget.exe uninstall -e --id JetBrains.PyCharm.Community --silent --accept-source-agreements

Detection script.

Create a PowerShell script and add the below script.

##What is the latest version Pycharm
$JBNSearch = winget.exe search -e --id JetBrains.PyCharm.Community --accept-source-agreements
$JBNOnlineVersion = (-split $JBNSearch[-1])[-2]

##What is the version installed
$JBNLocalSearch = winget.exe list -e --id JetBrains.PyCharm.Community
$JBNCheckIfAvailavbleExist = (-split $JBNLocalSearch[-3])[-2]
if($JBNCheckIfAvailavbleExist -eq "Available")
{
    $JBNLocalVersion = (-split $JBNLocalSearch[-1])[-3]
}
else
{
    $JBNLocalVersion = (-split $JBNLocalSearch[-1])[-2]
}
if($JBNLocalVersion -eq "input")
{
    exit 1
 #Detection failed
}
if($JBNLocalVersion -ge $JBNOnlineVersion)
{
    Write-Output "The Device got the latest version of Postman installed"
 exit 0
 #Detection success
}
else
{
 exit 1
 #Detection failed
}

Download Microsoft Win32 Content.

Web url: https://learn.microsoft.com/en-us/mem/intune/apps/apps-win32-prepare

Download url: https://github.com/Microsoft/Microsoft-Win32-Content-Prep-Tool

Package the PowerShell script.

Open IntuneWinAppUtil.exe as an administrator.

Enter source directory.

Specify installation file name.

Specify output folder path.

Package Created

Application deployment in Intune.

Installation & Uninstallation command.

Only change the ps1 file name

Installation Command

powershell.exe -WindowStyle hidden -ExecutionPolicy ByPass -File .\Pycharminstallation.ps1

Uninstall Command

powershell.exe -WindowStyle hidden -ExecutionPolicy ByPass -File .\Pycharmuninstallation.ps1

Review and Create

Install the application form the Company Portal

Dinesh D P
Dinesh D P
As a seasoned Senior DevOps Engineer at Virtual Petals, I bring a wealth of expertise in Microsoft Cloud, DevOps, and the Microsoft 365 Stack. With a track record of delivering successful projects across the globe.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

× How can I help you?