Cloudy: With a chance of Winget

This blog will be about the experience I had with Winget. Until now we only made use of Chocolatey but I was intrigued if Winget could be a good replacement. After reading some other blogs and information I decided to test it out myself.

Just like always, I am going to divide this blog into multiple parts.

  1. Background information
  2. Installing the App Installer
  3. Installing/removing applications
  4. Upgrading applications
  5. Winget ADMX
  6. Troubleshooting Winget
  7. Upload your own Apps
  8. Deploying the apps with the Company Portal app

1. Background Information

Just like Chocolatey, Winget is a  tool to manage packages (Package Manager) on your device. This utility gives you the possibility to automate the whole process of installing/removing/upgrading (updating)  packages (software) on the device.

Just with the use of the command line or PowerShell you could automatically download the packages and install them on the device. When you have some experience with Linux you will be familiar with it but Windows users didn’t have this built-in functionality so they needed to use some third-party software like Chocolatey.

Luckily in 2020 Microsoft released its own Windows Packaging Manager (Winget) for Windows 10. But when it was released it was a little bit buggy in my opinion. But things have changed a little bit, so I wanted to take a closer look at it.

2. Installing the App Installer (Winget)

When you want to play around or just want to start migrating your Chocolatey apps to Winget, you will need to make sure Winget is installed on the devices. On all modern versions of Windows 10 and Windows 11 this Package Manager Command-line tool is already installed. As shown below Microsoft.DesktopAppInstaller is already installed by default!

But it will take some time before the Winget.exe tool itself gets installed and in the meantime, the Winget.exe Command is NOT yet available on Windows 10 device!

Before the winget.exe will be deployed It first needs to fetch the update from the Microsoft Store for business.

After it downloads the latest update, you will notice that a new version is installed and inside that folder, the Winget.Exe file does exist. I am wondering what will happen when you are deploying an app with Winget during Autopilot?

If you still have some older Windows versions you need to install it manually. You have got multiple options to install Winget

  1. Install the App Package with Powershell
  2. Deploy the App Installer from the Microsoft Store

2.1. Using PowerShell

You could call upon the invoke web request to download the app package file straight from the source. Please note: Before we could install the DesktopAppinstaller we need to make sure all the requirements are met! To do so I added the Add-AppxPackage Microsoft.VClibs to the script

$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"") {
    "Installing winget Dependencies"
    Add-AppxPackage -Path ''

    $releases_url = ''

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    $releases = Invoke-RestMethod -uri $releases_url
    $latestRelease = $releases.assets | Where { $_.browser_download_url.EndsWith('msixbundle') } | Select -First 1

    "Installing winget from $($latestRelease.browser_download_url)"
    Add-AppxPackage -Path $latestRelease.browser_download_url
else {
    "winget already installed"
#### Creating settings.json #####

if ([System.Security.Principal.WindowsIdentity]::GetCurrent().IsSystem) {
        $SettingsPath = "$Env:windir\system32\config\systemprofile\AppData\Local\Microsoft\WinGet\Settings\settings.json"
        $SettingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json"
    if (Test-Path $SettingsPath){
        $ConfigFile = Get-Content -Path $SettingsPath | Where-Object {$_ -notmatch '//'} | ConvertFrom-Json
    if (!$ConfigFile){
        $ConfigFile = @{}
    if ($ConfigFile.installBehavior.preferences.scope){
        $ConfigFile.installBehavior.preferences.scope = "Machine"
    }else {
        Add-Member -InputObject $ConfigFile -MemberType NoteProperty -Name 'installBehavior' -Value $(
            New-Object PSObject -Property $(@{preferences = $(
                    New-Object PSObject -Property $(@{scope = "Machine"}))
        ) -Force
    $ConfigFile | ConvertTo-Json | Out-File $SettingsPath -Encoding utf8 -Force

2.2 Microsoft Store

If you don’t like to use a simple PowerShell script you could make sure that The Windows Package Manager is installed from within the Microsoft Store. But of course, you will need to make sure you have configured/synced the Microsoft store with your Microsoft 365 tenant.

When you have made sure the Microsoft store for business is connected you can click on the “Open the business store” to start searching. Search for the “App installer” package and install/order it.

I will advise you to use the Offline version of the App Installer as shown below so you can make sure the app will be delivered in the Device context

If you want to know more about why this is important please read this blog. In this blog, I am explaining the differences between the Online and Offline version

Company Portal | Intune | Offline (device) vs Online (user) (

When you have made sure the App Installer is approved don’t forget to sync and assign the app in Intune when you have added the app to the collection.

Please Note: When assigning the app, please make sure when you are using the offline version you also configure the license type to device!

3. Installing and Removing applications

Installing Applications

Installing applications is normally done within a few seconds. If you want to get a list of all the applications you could install, just specify the “install” or “show” parameter and it will list all the packages out there.

Another possibility to get a list of all apps you could install is to open the browser and browse to

winget-pkgs/manifests at master · KaranKad/winget-pkgs (

Let’s proceed with installing some applications/packages. So if you want to install WebView2, you will need to specify this command.

$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
    if ($ResolveWingetPath){
           $WingetPath = $ResolveWingetPath[-1].Path

cd $wingetpath
.\winget.exe install --exact --id Microsoft.EdgeWebView2Runtime --silent --accept-package-agreements --accept-source-agreements

If you want to have multiple apps installed at the same time you could use the ; between specifying the apps

winget install 7zip.7zip  ;  winget install Mozilla.Firefox  – -force – – silent

Please Note:

Before installing applications, make sure you have taken a look at the settings.json in Winget. Maybe you want to make sure the packages are installed for the entire machine instead of the current user?

This is my settings.json file which I tested Winget with

Removing Applications

Removing existing software is also very very easy. You will only need to specify the uninstall parameter and which apps need to be removed

winget uninstall –name Microsoft.Teams

It’s simple and it works just like it should and nothing more.

4. Upgrading applications

Just like with chocolatey you will get the possibility to update/upgrade apps. It’s very easy to upgrade the apps, you only need to specify the upgrade parameter and which app you want to update.

Or use the “list option” to check if a new version is available.

I guess I am going to like this Winget update function a lot more in the feature than Chocolatey. Winget lists all applications which needed to be updated! Chocolatey only lists the applications which needed to be updated that chocolatey installed itself.

When you need to update all apps with Winget specify the upgrade  – -all parameter.

If you want to make sure your apps are upgraded each week you need to create a PowerShell script and convert it to a Win32app. This script will create an additional PowerShell script and attach it to a task schedule. Please Note: Sometimes stuff changes and I need to update my blog. I needed to add the –accept-source-agreements , otherwise, the upgrade was still waiting for approval!

$content = @'
winget source remove msstore
winget source reset --force 
winget upgrade --query --silent --force --accept-package-agreements --accept-source-agreements --all

# create custom folder and write PS script
$path = $(Join-Path $env:ProgramData CustomScripts)
if (!(Test-Path $path))
New-Item -Path $path -ItemType Directory -Force -Confirm:$false
Out-File -FilePath $(Join-Path $env:ProgramData CustomScripts\WingetUppgradeApps.ps1) -Encoding unicode -Force -InputObject $content -Confirm:$false
# register script as scheduled task
$Time = New-ScheduledTaskTrigger -AtLogOn
$User = "SYSTEM"
$Action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ex bypass -file `"C:\ProgramData\CustomScripts\WingetUppgradeApps.ps1`""
Register-ScheduledTask -TaskName "UpgradeApps" -Trigger $Time -User $User -Action $Action -Force
Start-ScheduledTask -TaskName "UpgradeApps"

The only two things I am missing (for now) are:

  1. Excluding applications.

When you have teams installed it will try to update teams…. And most of the time it will fail. Luckily when other programs needed to be updated it will just proceed even with the first installation error.

2.No applicable update found

And I guess that’s why I was mentioning: “I am going to like this update function” because for now a lot of already installed programs can not be upgraded! You will be prompted with: No applicable update found.

But when I remove the zoom 5.5.2 application first and reinstall the same version again with the parameter: Winget install zoom.zoom – -version 5.5.2

I can upgrade it with no problem at all? that’s odd but I know it can be very difficult to make sure all the packages can be updated. Maybe a better option would be to use this wonderful tool!

GitHub – Romanitho/Winget-AutoUpdate: WAU daily updates apps as system and notify connected users. (Allowlist and Blocklist support)

5. Winget ADMX

I guess I really love this one. Winget even has its own ADMX files which you can use to limit some functions:

I guess when I am going to only use Winget, I will take some time to make sure you can ingest the ADMX in Intune. Isn’t that cool?

6. Troubleshooting Winget installation errors

If you have the same luck like me, you always will directly end up with some troubleshooting. Don’t get me wrong, but I love when it fails on the first attempt… if al succeeds without errors, you don’t get the possibility to start troubleshooting it.

Luckily you will get a very nice log file, which I didn’t expect to be good…

Like I was telling you with the upgrade – option,  upgrading teams is difficult. It’s not Winget that is causing the problem but it’s the Teams installer.

Luckily I have some experience with Teams installers so I got you covered!

7. Building your own packages

If you want to start building your own packages you will need to install the create module first: “Winget install wingetcreate”

After the module is installed you can just create a new package when you enter this command: wingetcreate new. It will ask you for the download URL location of the installation file.

As an example, I specified the notepad + + exe download url

It will guide you to the whole process. It will ask you some default questions which need to be answered.

When you are almost done it will ask you to submit the package to your own repository and prompt you for your GitHub credentials.

As shown above, I used the NotePad + + example, it’s already in the repository. Just within a minute, I (of course) received a message that it’s already in the repository.  So I closed the pull request.

8. Deploying the App to your devices with the Company Portal app

Just like my blog about the Win32 PowerShell express and my blog about why you need to start loving the Company Portal App. You can create all the installation packages from scratch and upload them to Intune with PowerShell


When all the problems with Winget are resolved you will need to start converting your Powershell/Chocolatey Win32 apps to Winget Applications.

I prefer to use a built-in utility over a third-party tool but for now, I will stick to Chocolatey. I hope I can update this blog in the near future to tell you I am migrating all packages to Winget

9 thoughts on “Cloudy: With a chance of Winget

  1. How do you deploy the .json configuration file to endpoints using Intune? It is per-user (%LOCALAPPDATA%) so would need to be deployed to every active user’s profile on every endpoint?

    1. Thanx for telling.. but what is not working?
      The creation of the task or executing the task. Just tested it (not with intune) but with a normal powershell system powershell and the scheduler is created. I am using this method for lots of stuff
      So how can I help you?

      1. Thanks for the quick reply! So the script does in fact create the task but when run nothing actually happens. Nothing Updates when trying to check winget list afterwards. I have tried using system as well as the logged in user to run it as.

        1. I noticed the same.. I already updated the blog… Somehow you need to add this to the script –accept-source-agreements

  2. FYI: Needed to change the winget upgrade query a bit for me to work just fine:

    winget upgrade –query –silent –force –accept-package-agreements –accept-source-agreements –all

    cheers! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

  +  63  =  68