How to Install and Use WinGet During AutoPilot

In this post, I will show you how to install the latest version of WinGet during the AutoPilot process and subsequently deploy application using the WinGet command line tool at the same time.

This will enable you to use the WinGet command line tool to manage application both during the AutoPilot process and immediately after login.

What is WinGet?

WinGet is a command line tool for the Windows Package Manager solution, which enables you to find, install, upgrade or remove applications on Windows 10 and 11 computers.

It is a fast and effective tool for deploying applications onto workstations remotely, especially using Microsoft Intune.

Is WinGet pre-installed with Windows?

Modern versions of Windows 10 (1709 or later) and all versions of Windows 11 come pre-installed with Windows Package Manager (WinGet) by default.

This poses the question, why install it manually if it likely is already deployed? While the Windows Package Manager is installed, it can take a while for the command line tool to become available. This only happens once the user logs in and triggers Microsoft Store to register Windows Package Manager. Hence, the need to install is manually.

WinGet versions and file size

I want to mention the file sizes of WinGet and the different versions available. This is because starting in WinGet version 1.6.1573-preview, .NET and PowerShell host have been included in the bundle, increasing the package file size by 20 times!

This was highlighted on GitHub in the discussions section of said version by the maintainer.


For the latest release without these resource-heavy features built in, ensure you install version 1.5.2201. However, if you want to use WinGet to deploy the applications during AutoPolit provisioning, install the LATEST version as per my script.

Step 1: Creating the install script

You first need to create a script that will install WinGet. 

Below is a simple script that will first check if WinGet is already installed; then, if it isn’t, it will download the recommended version of WinGet and the dependencies from the official repositories and install them.

This script is also accessible from GitHub.

Installs WinGet, for use with Intune

   Version:        0.1
   Author:         Daniel Bradley
   Creation Date:  Friday, January 5th 2024, 5:18:37 pm
   File: Install-winget.ps1

Deploy as Intune script

Use this code free of charge at your own risk.
Never deploy code into production if you do not know what it does.

#Create path and define log file
$path= "C:\ProgramData\WinGet"
$LogFile = "InstallLog.txt"
mkdir $path -ErrorAction SilentlyContinue

#Write to log
Function LogWrite
   Param ([string]$logstring)
   $date = (Get-Date).tostring("yyyyMMdd-HH:mm")
   Add-content "$path\$Logfile" -value "$date - $logstring"

#Check if WinGet is Installed
$TestPath = "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.3482.0_x64__8wekyb3d8bbwe\AppxSignature.p7x"
$Winget = Test-path $TestPath -PathType Leaf

#Install WinGet
if (!$Winget){
    LogWrite "WinGet not installed, attempting install with Add-AppxPackage"
    Try {
        LogWrite "Downloading WinGet and its dependencies..."
        Start-Transcript -Path "$path\$Logfile" -Append
        Invoke-WebRequest -Uri -OutFile "$path\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -Verbose
        Invoke-WebRequest -Uri -OutFile "$path\Microsoft.VCLibs.x64.14.00.Desktop.appx" -Verbose
        Invoke-WebRequest -Uri -OutFile "$path\Microsoft.UI.Xaml.2.7.x64.appx" -Verbose
        Add-AppxProvisionedPackage -online -packagepath $path\Microsoft.VCLibs.x64.14.00.Desktop.appx -SkipLicense -Verbose
        Add-AppxProvisionedPackage -online -packagepath $path\Microsoft.UI.Xaml.2.7.x64.appx -SkipLicense -Verbose
        Add-AppxProvisionedPackage -online -packagepath $path\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -SkipLicense -Verbose
    Catch {
        Write-host "Unable to complete offline installer"
} Else {
    LogWrite "WinGet already installed"

Save this script as Install-WinGet.ps1, then you can test the script during the OOBE in AutoPilot to confirm it works and that WinGet works also!

At the OOBE screen, click SHIFT+F10 and type the following: (you file path for the PowerShell script may differ).

Set-ExecutionPolicy Unrestricted

Once install is complete, test installing Google Chrome with the following command:

winget install -e --id Google.Chrome
WinGet with AutoPilot
WinGet with AutoPilot

Step 2: Upload the script to Intune

Next, you will need to upload your script to Intune. I have opted to deploy this via a script, instead of packaging into a Win32 app, but you can deploy either way. (if you are packaging into a Win32 app, you may need to add more logic to the code).  In my opinion, WinGet will deploy and maintain after this installation, so I plan on forgetting about it after installation.

If you want to deploy applications at the same time during the OOBE, you can append the follow lines of code onto the script: (change the Google.Chrome to you preferred app)

Alternatively, you can package this up separately and deploy it as a Win32 application (this will run after the script finishes executing during the OOBE). I couldnt get this to work, but drop me a message if you can!

cd "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.3482.0_x64__8wekyb3d8bbwe\"
LogWrite "location set to $((Get-Location).Path)"
.\Winget install Google.Chrome --accept-package-agreements --accept-source-agreements | Tee-Object "$path\$Logfile" -Append

Follow the below steps to deploy the script from the Intune admin center.

1. Log in to

2. Select Devices, then under policy, select Scripts.

3. Select Add > Windows 10 and later.

4. Define and name and click Next. On the Script settings page, select the following settings

Upload WinGet Script
Upload WinGet Script

5. Assign your script to all devices (or your preferences) and complete the wizard.

Wrapping up

If you made it this far, great! I want to advise that installing apps during this phase of the OOBE using the WinGet command line tool is a proof of concept. Of course, there are better ways to package, deploy and maintain your apps, but everyone has their preference.

Immediately after first log in we can see that Google Chrome has been successfully installed using WinGet.

Winget application installed during AutoPilot
Winget application installed during AutoPilot

Daniel Bradley

My name is Daniel Bradley and I work with Microsoft 365 and Azure as an Engineer and Consultant. I enjoy writing technical content for you and engaging with the community. All opinions are my own.

This Post Has 5 Comments

  1. Tobias

    I did this some months ago and I had big issues installing apps in OOBE after Winget was installed. I tried several methods but all of them made issues, and winget didn’t run correctly in OOBE.

    Only by installing apps after OOBE at the user signin or later on I was able to successfully install apps.

    1. Daniel Bradley

      I had similar issues on older versions of WinGet, but since it was packaged with .NET is seems to work OK (I has similar issues in Windows Sandbox). I still haven’t got the packaging working with Win32 apps. I also think in the script the WinGet process is being stopped, then the script is re-attempted after reboot it is is successful before the user signs-in..

  2. Peter

    Been trying to get some form of WinGet working with Intune for the longest time, but constantly running into “This app is not supported in preview” or the app is only available in the public repo. It’s so annoying! Glad I ran into your post here, I will try it.

    1. Daniel

      Thanks Peter, let me know how you get on!

  3. Nick

    I install chrome via winget. This was the final piece I needed. I also have WIN32 package working. This is how I call the script above. I use this PS1 to install the apps:


    “%systemroot%\sysnative\WindowsPowerShell\v1.0\powershell.exe” -NoProfile -ExecutionPolicy Bypass -File winget-install.ps1 -AppIDs 7zip.7zip -LogPath c:\wingetlogs

    as the commandline. I have a dependency of the update script above. Again packaged as a WIN32 and using

    “%systemroot%\sysnative\WindowsPowerShell\v1.0\powershell.exe” -NoProfile -ExecutionPolicy Bypass -File update-winget.ps1

    as the commandline. Detection for install is file

    C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.3482.0_x64__8wekyb3d8bbwe\AppxSignature.p7x

Leave a Reply