Windows Sandbox configuration
Если песочница не запускается, и вы получаете ошибку 0x80070002 с сообщением « Не удается найти указанный файл », то это означает, что у вас нет всех необходимых обновлений. Чтобы решить проблему установите обновление KB4512941 . Также для решения проблемы можно установить английскую версию операционной системы и потом накатить на нее русский языковый пакет.
Как включить и пользоваться Песочницей в Windows 11 или Windows 10
В Windows 11 и Windows 10 доступно немало интересных функций, которые снимают необходимость в установке специализированных программ от сторонних разработчиков. Одной из таких функция является Песочница или Sandbox. Песочница – это специальное виртуальное окружение, позволяющее запускать потенциально опасные программы без риска повреждения операционной системы. Такая защита реализуется за счет того, что запускаемое приложение оказывается в виртуальной машине, которая полностью изолирована от основной системы.
Конечно, что-то подобное было доступно и раньше. Но, тогда для безопасного запуска ненадежного ПО требовалась установка специальных программ. Например, можно было использовать бесплатную виртуальную машину VirtualBox. Теперь же эта функция доступна всем пользователям Windows из коробки.
Единственное ограничение – это версия Windows. Для того чтобы использовать Песочницу вам понадобиться профессиональная (Pro) или корпоративная (Enterprise) версия Windows 10 (1903+) или Windows 11. Впрочем, даже это ограничение можно обойти и установить Песочницу в Домашнюю версию Windows 10.
Как включить Песочницу в Windows 11, 10
Для включения Песочницы в Windows 11 или Windows 10 можно использовать разные способы: окно « Компоненты Windows », консоль PowerShell или командную строку. После включения система потребует перезагрузку компьютера и выполнит установку дополнительных компонентов. После этого Sandbox можно будет запустить из списка всех программ в меню « Пуск ».
Компоненты Windows
Для того чтобы включить Песочницу через окно « Компоненты Windows » нужно нажать комбинацию клавиш Win-R и выполнить команду « optionalfeatures ».
Также вы можете открыть « Панель управления » и перейти в раздел « Программы – Программы и компоненты – Включение и отключение компонентов Windows ».
После открытия « Компонентов Windows » нужно найти и включить опцию « Песочница Windows ». Дальше нужно завершить установку выбранного компонента и перезагрузить компьютер.
Для отключения Песочницы нужно просто зайти в « Компонентов Windows » и отключить указанную выше опцию.
PowerShell
Чтобы воспользоваться этим способом нужно запустить консоль PowerShell с правами администратора и выполнить следующую команду:
Enable-WindowsOptionalFeature -FeatureName "Containers-DisposableClientVM" -All -Online
После выполнения данной команды в консоли появится предложение перезагрузить компьютер. Введите английскую букву « y » чтобы согласится (yes).
Для отключения песочницы используйте следующую команду PowerShell:
Disable-WindowsOptionalFeature –FeatureName "Containers-DisposableClientVM" -Online
Командная строка
Еще один вариант — это включение через командную строку. Чтобы воспользоваться этим методом запустите командную строку Windows с правами администратора и выполните следующую команду:
Dism /online /Enable-Feature /FeatureName:"Containers-DisposableClientVM" -All
После выполнения данной команды в появится предложение перезагрузить компьютер. Введите английскую букву « y » чтобы согласится (yes).
Для отключения Песочницы используйте команду:
Dism /online /Disable-Feature /FeatureName:"Containers-DisposableClientVM"
После перезагрузки программа « Windows Sandbox » появится в меню « Пуск ». Ее можно будет найти в списке всех программ или с помощью поиска.
Все описанные выше способы включения Песочницы одинаково работают как в Windows 10, так и в Windows 11.
Как включить виртуализацию в BIOS
В некоторых случаях, пункт « Песочница Windows » в окне « Компоненты Windows » может быть неактивен, а при наведении курсора появится сообщение « Не удается установить Песочницу Windows: у процессора нет требуемых возможностей виртуализации ». Данная ошибка говорит о том, что на вашем компьютере отключена функция виртуализации или ваш процессор не поддерживает эту функцию.
Для включения виртуализации нужно зайти в BIOS, включить там соответствующую опцию и перезагрузить компьютер. В зависимости от производителя процессора и материнской платы название данной опции в BIOS может отличаться. Например, на платах для Intel это может быть « VT-x » или « Intel Virtualization Technology ».
А на платах для AMD — « AMD-v », « SVM » или « SVM Mode ».
После включения виртуализации в BIOS нужно перезагрузить компьютер, зайти в « Компоненты Windows » и включить Песочницу.
Как установить Песочницу в Windows 10 Home
Если же у вас домашняя версия Windows 10 (Windows 10 Home), то просто так включить Песочницу не получится. Ее нужно сначала установить при помощи командной строки. Для упрощения этой процедуры существует BAT-файл, который был написан немецким энтузиастом. Вы можете скачать этот файл и получить подробную информацию на этой странице (текст на немецком).
На странице доступно два файла:
- Sandbox Installer.zip – архив с BAT-файлом, который устанавливает Песочницу;
- Sandbox UnInstaller.zip – архив с BAT-файлом, который удаляет ранее установленную Песочницу;
На случай если ссылки не будут работать приводим содержимое обоих файлов.
Содержимое Sandbox Installer.bat:
@echo off echo Checking for permissions >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" echo Permission check result: %errorlevel% REM --> If error flag set, we do not have admin. if '%errorlevel%' NEQ '0' ( echo Requesting administrative privileges. goto UACPrompt ) else ( goto gotAdmin ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" echo Running created temporary "%temp%\getadmin.vbs" timeout /T 2 "%temp%\getadmin.vbs" exit /B :gotAdmin if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "%CD%" CD /D "%~dp0" echo Batch was successfully started with admin privileges echo . cls Title Sandbox Installer pushd "%~dp0" dir /b %SystemRoot%\servicing\Packages\*Containers*.mum >sandbox.txt for /f %%i in ('findstr /i . sandbox.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i" del sandbox.txt Dism /online /enable-feature /featurename:Containers-DisposableClientVM /LimitAccess /ALL pause
Содержимое Sandbox UnInstaller.bat:
@echo off echo Checking for permissions >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" echo Permission check result: %errorlevel% REM --> If error flag set, we do not have admin. if '%errorlevel%' NEQ '0' ( echo Requesting administrative privileges. goto UACPrompt ) else ( goto gotAdmin ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" echo Running created temporary "%temp%\getadmin.vbs" timeout /T 2 "%temp%\getadmin.vbs" exit /B :gotAdmin if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "%CD%" CD /D "%~dp0" echo Batch was successfully started with admin privileges echo . cls Title Sandbox Installer pushd "%~dp0" Dism /online /disable-feature /featurename:Containers-DisposableClientVM dir /b %SystemRoot%\servicing\Packages\*Containers*.mum >sandbox.txt for /f %%i in ('findstr /i . sandbox.txt 2^>nul') do dism /online /norestart /remove-package:"%SystemRoot%\servicing\Packages\%%i" del sandbox.txt pause
Для того чтобы установить Песочницу в Windows 10 Home (Домашняя) вам нужно просто скачать архив « Sandbox Installer.zip », распаковать его на своем компьютере и запустить BAT-файл.
После этого нужно дождаться завершения установки и перезагрузить компьютер. После перезагрузки компьютера программа Windows Sandbox появится с списке установленных программ в вашем меню « Пуск », и вы сможете начать ею пользоваться.
Данный способ включения Песочницы предназначет только для Windows 10 Home, но возможно он будет работать и в домашней версии Windows 11.
Как запустить Песочницу Windows 10, 11
Для запуска Песочницы нужно использовать меню « Пуск ». Откройте меню « Пуск », перейдите к списку установленных программ и найдите там Windows Sandbox .
После запуска Песочницы вы получите виртуальную машину с операционной системой Windows и доступом к интернету.
Данную виртуальную машину можно использовать для запуска потенциально опасных программ, не опасаясь за свою основную систему. Для переноса программ из основной системы в Песочницу можно использовать буфер обмена. Для этого просто воспользуйтесь функциями « Копировать » и « Вставить ».
Также нужно знать, что при каждом новом запуске Песочница обнуляется, поэтому в ней нельзя сохранять никаких важных файлов.
Песочница Windows 10 не работает, error 0x80070002
Если песочница не запускается, и вы получаете ошибку 0x80070002 с сообщением « Не удается найти указанный файл », то это означает, что у вас нет всех необходимых обновлений. Чтобы решить проблему установите обновление KB4512941 . Также для решения проблемы можно установить английскую версию операционной системы и потом накатить на нее русский языковый пакет.
- Онлайн проверка файла на вирусы
- Как установить Windows 7 или 10 на виртуальную машину
- Как отключить файрвол Windows 7
- Как отключить защитник Windows
- Как установить Linux на Windows 10 с помощью WSL
Создатель сайта comp-security.net, автор более 2000 статей о ремонте компьютеров, работе с программами, настройке операционных систем.
Остались вопросы?
Задайте вопрос в комментариях под статьей или на странице «Задать вопрос» и вы обязательно получите ответ.
Windows Sandbox configuration
Windows Sandbox supports simple configuration files, which provide a minimal set of customization parameters for Sandbox. This feature can be used with Windows 10 build 18342 or Windows 11. Windows Sandbox configuration files are formatted as XML and are associated with Sandbox via the .wsb file extension.
A configuration file enables the user to control the following aspects of Windows Sandbox:
- vGPU (virtualized GPU): Enable or disable the virtualized GPU. If vGPU is disabled, the sandbox will use Windows Advanced Rasterization Platform (WARP).
- Networking: Enable or disable network access within the sandbox.
- Mapped folders: Share folders from the host with read or write permissions. Exposing host directories may allow malicious software to affect the system or steal data.
- Logon command: A command that’s executed when Windows Sandbox starts.
- Audio input: Shares the host’s microphone input into the sandbox.
- Video input: Shares the host’s webcam input into the sandbox.
- Protected client: Places increased security settings on the RDP session to the sandbox.
- Printer redirection: Shares printers from the host into the sandbox.
- Clipboard redirection: Shares the host clipboard with the sandbox so that text and files can be pasted back and forth.
- Memory in MB: The amount of memory, in megabytes, to assign to the sandbox.
The size of the sandbox window currently isn’t configurable.
Creating a configuration file
To create a configuration file:
- Open a plain text editor or source code editor (for example, Notepad, Visual Studio Code, etc.)
- Insert the following lines:
Using a configuration file
To use a configuration file, double-click it to start Windows Sandbox according to its settings. You can also invoke it via the command line as shown here:
C:\Temp> MyConfigFile.wsb
Keywords, values, and limits
vGPU
Enables or disables GPU sharing.
- Enable: Enables vGPU support in the sandbox.
- Disable: Disables vGPU support in the sandbox. If this value is set, the sandbox will use software rendering, which may be slower than virtualized GPU.
- Default This value is the default value for vGPU support. Currently, this default value denotes that vGPU is disabled.
Enabling virtualized GPU can potentially increase the attack surface of the sandbox.
Networking
Enables or disables networking in the sandbox. You can disable network access to decrease the attack surface exposed by the sandbox.
- Enable: Enables networking in the sandbox.
- Disable: Disables networking in the sandbox.
- Default: This value is the default value for networking support. This value enables networking by creating a virtual switch on the host and connects the sandbox to it via a virtual NIC.
Enabling networking can expose untrusted applications to the internal network.
Mapped folders
An array of folders, each representing a location on the host machine that will be shared into the sandbox at the specified path. At this time, relative paths aren’t supported. If no path is specified, the folder will be mapped to the container user’s desktop.
absolute path to the host folder absolute path to the sandbox folder value .
HostFolder: Specifies the folder on the host machine to share into the sandbox. The folder must already exist on the host, or the container will fail to start.
SandboxFolder: Specifies the destination in the sandbox to map the folder to. If the folder doesn’t exist, it will be created. If no sandbox folder is specified, the folder will be mapped to the container desktop.
ReadOnly: If true, enforces read-only access to the shared folder from within the container. Supported values: true/false. Defaults to false.
Files and folders mapped in from the host can be compromised by apps in the sandbox or potentially affect the host.
Logon command
Specifies a single command that will be invoked automatically after the sandbox logs on. Apps in the sandbox are run under the container user account. The container user account should be an administrator account.
command to be invoked
Command: A path to an executable or script inside the container that will be executed after signing in.
Although very simple commands will work (such as launching an executable or script), more complicated scenarios involving multiple steps should be placed into a script file. This script file may be mapped into the container via a shared folder, and then executed via the LogonCommand directive.
Audio input
Enables or disables audio input to the sandbox.
- Enable: Enables audio input in the sandbox. If this value is set, the sandbox will be able to receive audio input from the user. Applications that use a microphone may require this capability.
- Disable: Disables audio input in the sandbox. If this value is set, the sandbox can’t receive audio input from the user. Applications that use a microphone may not function properly with this setting.
- Default: This value is the default value for audio input support. Currently, this default value denotes that audio input is enabled.
There may be security implications of exposing host audio input to the container.
Video input
Enables or disables video input to the sandbox.
- Enable: Enables video input in the sandbox.
- Disable: Disables video input in the sandbox. Applications that use video input may not function properly in the sandbox.
- Default: This value is the default value for video input support. Currently, this default value denotes that video input is disabled. Applications that use video input may not function properly in the sandbox.
There may be security implications of exposing host video input to the container.
Protected client
Applies more security settings to the sandbox Remote Desktop client, decreasing its attack surface.
- Enable: Runs Windows sandbox in Protected Client mode. If this value is set, the sandbox runs with extra security mitigations enabled.
- Disable: Runs the sandbox in standard mode without extra security mitigations.
- Default: This value is the default value for Protected Client mode. Currently, this default value denotes that the sandbox doesn’t run in Protected Client mode.
This setting may restrict the user’s ability to copy/paste files in and out of the sandbox.
Printer redirection
Enables or disables printer sharing from the host into the sandbox.
- Enable: Enables sharing of host printers into the sandbox.
- Disable: Disables printer redirection in the sandbox. If this value is set, the sandbox can’t view printers from the host.
- Default: This value is the default value for printer redirection support. Currently, this default value denotes that printer redirection is disabled.
Clipboard redirection
Enables or disables sharing of the host clipboard with the sandbox.
- Enable: Enables sharing of the host clipboard with the sandbox.
- Disable: Disables clipboard redirection in the sandbox. If this value is set, copy/paste in and out of the sandbox will be restricted.
- Default: This value is the default value for clipboard redirection. Currently, copy/paste between the host and sandbox are permitted under Default.
Memory in MB
Specifies the amount of memory that the sandbox can use in megabytes (MB).
If the memory value specified is insufficient to boot a sandbox, it will be automatically increased to the required minimum amount.
Example 1
The following config file can be used to easily test the downloaded files inside the sandbox. To achieve this testing, networking and vGPU are disabled, and the sandbox is allowed read-only access to the shared downloads folder. For convenience, the logon command opens the downloads folder inside the sandbox when it’s started.
Downloads.wsb
Disable Disable C:\Users\Public\Downloads C:\Users\WDAGUtilityAccount\Downloads true explorer.exe C:\users\WDAGUtilityAccount\Downloads
Example 2
The following config file installs Visual Studio Code in the sandbox, which requires a slightly more complicated LogonCommand setup.
Two folders are mapped into the sandbox; the first (SandboxScripts) contains VSCodeInstall.cmd, which will install and run Visual Studio Code. The second folder (CodingProjects) is assumed to contain project files that the developer wants to modify using Visual Studio Code.
With the Visual Studio Code installer script already mapped into the sandbox, the LogonCommand can reference it.
VSCodeInstall.cmd
Download vscode to downloads folder and run from downloads folder.
REM Download Visual Studio Code curl -L "https://update.code.visualstudio.com/latest/win32-x64-user/stable" --output C:\users\WDAGUtilityAccount\Downloads\vscode.exe REM Install and run Visual Studio Code C:\users\WDAGUtilityAccount\Downloads\vscode.exe /verysilent /suppressmsgboxes
VSCode.wsb
C:\SandboxScripts C:\Users\WDAGUtilityAccount\Downloads\sandbox true C:\CodingProjects C:\Users\WDAGUtilityAccount\Documents\Projects false C:\Users\WDAGUtilityAccount\Downloads\sandbox\VSCodeInstall.cmd
Example 3
The following config file runs a PowerShell script as a logon command to swap the primary mouse button for left-handed users.
C:\sandbox folder on the host is mapped to the C:\sandbox folder in the sandbox, so the SwapMouse.ps1 script can be referenced in the sandbox configuration file.
SwapMouse.ps1
Create a powershell script using the following code, and save it in the C:\sandbox directory as SwapMouse.ps1 .
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null $SwapButtons = Add-Type -MemberDefinition @' [DllImport("user32.dll")] public static extern bool SwapMouseButton(bool swap); '@ -Name "NativeMethods" -Namespace "PInvoke" -PassThru $SwapButtons::SwapMouseButton(!([System.Windows.Forms.SystemInformation]::MouseButtonsSwapped))
SwapMouse.wsb
C:\sandbox C:\sandbox True powershell.exe -ExecutionPolicy Bypass -File C:\sandbox\SwapMouse.ps1
Comments are closed, but trackbacks and pingbacks are open.