Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Launch Windows Sandbox with Winget Enabled Automatically

August 21, 2024
in A, Blog, Windows Sandbox, WinGet
0
ADVERTISEMENT

Table of Contents

What is Windows Package Manager?

Winget is the awesome Windows Package Manager CLI tool that lets you discover, install, upgrade, remove, and configure applications on Windows 10 and Windows 11 computers. Winget manages your software without having to deal with graphical interfaces or web browsers. You can just type a few commands in your terminal and get things done quickly and efficiently.

PS C:\> winget
Windows Package Manager v1.6.3482
Copyright (c) Microsoft Corporation. All rights reserved.

The winget enables installing applications and other packages from the command line.

usage: winget  [<command>] [<options>]

The following commands are available:
  install    Installs the given package
  show       Shows information about a package
  source     Manage sources of packages
  search     Find and show basic info of packages
  list       Display installed packages
  upgrade    Shows and performs available upgrades
  uninstall  Uninstalls the given package
  hash       Helper to hash installer files
  validate   Validates a manifest file
  settings   Open settings or set administrator settings
  features   Shows the status of experimental features
  export     Exports a list of the installed packages
  import     Installs all the packages in a file
  pin        Manage package pins
  configure  Configures the system into a desired state
  download   Downloads the installer from a given package

For more details on a specific command, pass it the help argument. [-?]

Launch Windows Sandbox with Winget Enabled

But what if you want to use Winget in a sandbox environment? Maybe you want to test some new software without affecting your system’s stability or security. Or maybe you just want to experiment with different versions of applications without messing up your configuration.

Well, unfortunately, Winget is not available in the sandbox by default. Neither is the Microsoft Store app that distributes Winget as part of the App Installer package. So how can we get Winget in the sandbox every time we start the sandbox automatically?

sgeZjwa3G33A6V1FUqSm9KqCR1FBW4hw06KOKXZJGsoSynyioF35dijC3C5W

The answer is simple: we can create our own .wsb file. A .wsb file is a configuration file that specifies how Windows Sandbox should run. It can include settings such as networking options, shared folders, mapped drives, startup commands, and more. By creating a custom .wsb file, we can download and install Winget inside the sandbox automatically on boot:

1. Right-click on the desktop and create a new text document.

ByGO0HM9zIztouMlHRwra2kgmx5N2eHOmUrs6NYAYPTQ6rGmkyeHiykxZWVQ

2. Below is an example of a sandbox configuration file. It takes effect when a sandbox instance is initiated.

  • The folder C:\Apps would be mapped to the sandbox at C:\Apps.
  • The PowerShell script in the mapped folder (C:\Apps\onboot.ps1) would be executed automatically.
<Configuration>

  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\Apps</HostFolder>
      <SandboxFolder>C:\Apps</SandboxFolder>
      <ReadOnly>false</ReadOnly>
    </MappedFolder>
  </MappedFolders>

  <LogonCommand>
    <Command>powershell -executionpolicy unrestricted -command "start powershell {-noexit -file C:\Apps\onboot.ps1}"</Command>
  </LogonCommand>

</Configuration>

3. Save the file with any name, but make sure the file extension is .wsb.

iHOBerfDvlDjeequz8aQ1wXGIg4GRVFka7POFIknnqOSFW8vsKrlh4R45L0M

4. Next, create a PowerShell script onboot.ps1 for sandbox login, which is placed into C:\Apps on the host machine. This file would be executed every time the sandbox instance runs and below is its content:

Set-Location $env:temp

Write-Host "Installing Windows Package Manager (winget)..." -ForegroundColor Green
$progressPreference = 'silentlyContinue'
Invoke-WebRequest -Uri 'https://aka.ms/getwinget' -OutFile 'Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
Invoke-WebRequest -Uri 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' -OutFile 'Microsoft.VCLibs.x64.14.00.Desktop.appx'
Invoke-WebRequest -Uri 'https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx' -OutFile 'Microsoft.UI.Xaml.2.7.x64.appx'

Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
PbGRf8SyNJKBY5yswCMqezewhVd9p9hv1bXZgIrazLZXuZRVmes8ohDVfQXf

5. Now, start the sandbox using the .wsb configuration file instead of running it from the Start menu or Windows search.

IQLmOviYe46gickPNesoQSM2Yjbms53CTsGSnFrETCKSTOqC0vgxgtswFRC4

Every time you run a new sandbox instance, the script will be executed and the winget should be installed automatically in the sandbox instance.

PYEtMARyjE94ilLcDB0t847WCY3cq5g5PcmZ1GbfRjPRf6pL76QheiUlf12R

Below is an example of installing Google Chrome using winget in Windows Sandbox.

vl8KtQfdgYE09QAy5hW9d8HqtmFBO4EVPpxgB7IGiWOCCiKQdVIhKnky4D4L

Alternatively, you can download all required files and put them in the shared folder on the host machine. Edit the PowerShell script to install winget using the local files instead of downloading them every time you start a new sandbox instance.

BLBhKabQyjE0RFvHqNwid3KtNgpf2brpINJpqWooWKxNbNtWZ9cnFuJO27td
Set-Location C:\Apps

Write-Host "Installing Windows Package Manager (winget)..." -ForegroundColor Green
$progressPreference = 'silentlyContinue'
Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
ADVERTISEMENT

Not a reader? Watch this related video tutorial:

Related Titles:

  • How to Install macOS with a Broken MacBook Screen
  • Installing macOS on MacBook with External Monitor
  • MacBook Screen Broken? Install macOS Easily
  • Guide to Installing macOS with a Non-Functional Screen
  • How to Set Up macOS on MacBook Using External Display
  • Install macOS on MacBook Without Working Screen
  • Broken MacBook Screen? Here’s How to Install macOS
  • MacBook Repair: Installing macOS with Broken Display
  • How to Use External Monitor to Install macOS on MacBook
  • Fix MacBook with Broken Screen: Install macOS
  • Step-by-Step macOS Installation with Broken Screen
  • Installing macOS Using External Monitor on MacBook
  • How to Restore macOS with MacBook Screen Not Working
  • Installing macOS on MacBook with Cracked Screen
  • How to Use External Display for macOS Installation

 

Keywords: install macOS broken MacBook screen, macOS installation external monitor, install macOS MacBook cracked screen, MacBook broken screen OS installation, external monitor macOS setup, macOS install MacBook screen not working, macOS restore external display, install macOS without MacBook screen, broken screen MacBook macOS setup, macOS reinstall broken display.

 

Hashtags: #MacBookRepair, #macOSInstallation, #TechGuide, #MacTutorial, #BrokenScreenFix, #ExternalMonitor, #MacBookSetup, #DIYTech, #MacFix, #bonguides

5/5 - (2 votes)
Previous Post

How to Move Contact from the Left Side to Bottom in Microsoft Outlook

Next Post

How to Fix Cannot Access CyberPanel After Change Default Port 8090

Related Posts

Images Hidden Due To Mature Content Settings In CivitAI

August 31, 2024

Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

August 20, 2024

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024

How to Remove The Test Mode Watermark Without Disabling Test Mode

July 28, 2024

Leave a Reply Cancel reply

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

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory