Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Overview
Sample Test Mode (STM) is a feature that allows for faster image restoration of sampled devices on the factory floor. The feature utilizes a filter driver that is attached to the Windows partition and records all the file system operations on the device as well as backs up altered or deleted files. This feature reduces manufacturing time and cost for OEMs and ODMs when testing sample devices because they don’t need to reimage the device. Instead, the filter driver logs all activities and reverts the device back to the default state for user shipment. At a high level, below is the Sample Testing Mode process:
- The manufacturer takes a device (likely in a packaged shipping state) from the factory floor/warehouse and boots the machine into WinRE (Recovery OS).
- The manufacturer runs a Microsoft provided command on the device with the installed Windows image to activate the feature/filter driver. The technician then boots the device to simulate an end user and performs sample quality tests (e.g., Complete OOBE, connect to the internet, download/install updates, install features, etc.).
- Once testing is complete, the manufacturer boots the machine into WinRE and runs another command to revert the device to its original state prior to OOBE. The operation to revert the device is significantly faster compared to re-imaging.
- The result would be a Windows image that is identical to the condition before OOBE. The manufacturer then powers off the device and gets it ready for shipping.
Sample Test Mode Releases
Sample Test Mode is only supported on Client Windows Editions. See below for Windows version.
Windows Version | Release |
---|---|
Windows 11 | 24H2 |
Command Lines
To enter Sample Testing Mode, start your machine without any changes made and boot into WinRE. The following DISM commands are then used to enable and revert changes.
Command Lines | Description | Prerequisite |
---|---|---|
/Start-DUTMode | Start test mode after booting into WinRE |
|
/Revert-DUTMode | Revert changes made during test mode for machine to return to original state |
|
Usage Guide for Sample Test Mode
To start the Sample Test Mode
- Boot to the OOBE screen
- Press Ctrl-Shift-F5, this should reboot the machine to the recovery OS
- Choose “Troubleshoot” > “Advanced options” > “Command Prompt”, this should open a cmd.exe window
- Run the DISM command to activate the DUT mode: dism.exe /Start-DUTMode
DISM.exe /Start-DUTMode
- The machine is now ready to test with the filter driver (WinSetupBak) attached and running. You can run fltmc.exe to see the driver(WinSetupBak) at the bottom of the stack.
DISM.exe /fltmc.exe
To revert changes made during testing
Important
Before starting the restore procedure, make sure to use “manage-bde” to get the BitLocker status, and fully decrypt the OS partition and disable BitLocker.
- When you are ready to restore the devices to its original state, go to the “Settings” app
- In the “System” tab, on the right side scroll down to the “Recovery” tile, click on it.
- In the “Advanced startup” tile, click on the “Restart now” button. The machine should now reboot to the recovery OS.
- Choose “Troubleshoot” > “Advanced options” > “Command Prompt”, this should open a cmd.exe window
- Run the DISM command to revert the DUT mode: dism.exe /Revert-DUTMode
DISM.exe /Revert-DUTMode
- You should see one progress bar and the confirmation that the command completed successfully.
Troubleshooting STM
Where To Find STM Log Files
This section explains where to find the necessary log files based on the outcome of your operation.
Successful Revert
If the revert operation was successful, all relevant log files can be found in the following directory:
X:\Windows\Logs\DISM
Troubleshooting Failures:
Please collect the following log files for troubleshooting purposes based on the specific failure scenario:
- Failure to start DUT mode: Collect logs from:
X:\Windows\Logs\DISM
- Failure to revert DUT mode: Immediately after the revert fails, collect logs from:
X:\Windows\Logs\DISM
C:\$WINDOWS.~BK\WinSetupBak.log
C:\$WINDOWS.~BK\Operations.jrn
Advanced Troubleshooting (Verbose Logging):
For more detailed logs to help resolve complex issues:
- Set the environment variable
WINSETUPBAK_VERBOSE=1
before reproducing the problem. - Collect the log files as described in the "Troubleshooting Failures" section relevant to your scenario.
Important Note: Enabling verbose logging will generate very large log files (potentially over 1GB) and may slow system performance. Use this option only when specifically needed for in-depth investigation.
Support on Disk Partitions
Disk Partition Layout
The initial release of this feature only supports the following disk partition layout:
- Single Disk
- Standard UEFI partition layout: EFI System, MSR, Windows, and Recovery partitions
Changes to Device
The initial release of this feature only supports reverting changes to the following partitions:
- EFI System
- Windows
- Recovery
All other changes to the device’s state, including the following are not supported and will not be able to revert:
- Changes to disks and partitions outside of supported disk partition layout and supported partitions.
- Newly created files and modifications to the new files in WinRE and EFI System partition will not be supported and changes made are irreversible. However, changes made to existing files can be reversed with /Revet-DUTMode.
- Added or removed partition after /Start-DUTMode
- Changes to the device’s UEFI state
- Changes to the device’s firmware state
FAQ
What are the limitations of this feature?
Changes to the device that will NOT be restored by the feature:
- Changes to the content of any partitions outside of the MainOS, EFI, and WINRE partitions. Currently changes made in WinRE and EFI partitions can be restored but not when new files are created, modified and deleted. Please see “Known Issues” section for more details.
- Changes to firmware.
- Service-side changes made during Sample Testing Procedure with cloud services.
How do we know the device is in Sample Testing Mode?
A watermark displayed in the OS has been planned to indicate when a device is in STM. To identify a device in STM mode, you can run fltmc.exe to see the driver (WinSetupBak) at the bottom of the stack.
What are the known Issues as of now?
- In some cases, after ensuring BitLocker is decrypted, booting into WinRE, and running the DISM /Revert-DUTMode command, there is an extra “$Windows.~BK” folder still present on the disk. This is a known clean-up issue, and we plan to fix it in one of the next releases.
- Newly created files and modifications to the new files in WinRE and EFI System partition will not be supported and changes made are irreversible. However, changes made to existing files can be reversed with /Revet-DUTMode. We are working to fix the issue by the next releases.