There are some settings in the registry that can require a reboot before they take effect. Changing these settings in a Windows Sandbox and rebooting will not work since they will be reset when the sandbox starts up again. How can I run Windows 10 Sandbox with pre-configured registry keys?
4 Answers
You can achieve this by following the tutorial here. https://www.systanddeploy.com/2021/08/how-to-customize-default-windows.html
In a nutshell:
Mount the Windows Sandbox .vhdx.
Open regedit
Go to HKLM
Click on File
Click on Load hive
Browse E:\Files\Users\WDAGUtilityAccount\ntuser.dat
Type a name like 'test'
Change what you want
Click on File
Click on Unload hive
When you load the Sandbox, your reboot changes will be included.
- 1,087
Sandbox goes away at every restart. That is the Sandbox design and I have not seen any changes to it. It is designed to be completely temporary.
If you need a degree of permanence, consider a virtual machine. Hyper-V should come with the machine you have if Sandbox is running.
Windows Sandbox does not persist beyond a reboot.
If you wish a persistent sandbox, use the free and open-source Sandboxie.
You should note that any changes to Windows that require a reboot are useless, since the reboot will boot the unmodified Windows. Whether the changes done in the sandbox will have any effect, this depends only on the nature of the changes, so the newly installed features may not be usable.
- 498,455
The accepted answer from @YoSubs was no doubt correct at the time it was posted, but with later versions of Win 11 (I'm on 23H2), I have found the sandbox architecture has changed.
The registry files no longer appear to be stored within Sandbox's .vhdx. As a heads up, just mounting it on my system corrupted the set of disk / difference files sandbox uses, and it would no longer start until an uninstall / install cycle of the feature.
The files now APPEAR (see below) to be on the host system, located in subfolders of
C:\ProgramData\Microsoft\Windows\Containers\BaseImages\<GUID>\BaseLayer\Files\
Like the registry in a normal Windows installation, the data is split over a number of files and I got great help from this answer.
User keys are in:
C:\ProgramData\Microsoft\Windows\Containers\BaseImages\<GUID>\BaseLayer\Files\Users\WDAGUtilityAccount\ntuser.dat
and Local Machine keys can be found in several files with no extension here:
C:\ProgramData\Microsoft\Windows\Containers\BaseImages\<GUID>\BaseLayer\Files\Windows\System32\config\
such as SOFTWARE, SECURITY, SYSTEM, etc.
HOWEVER, for the change I was attempting to make, alterations to the Software hive did not show up in the sandbox machine, so your mileage with this information may vary!
- 226