Turn off API Sampling
Désactiver l’échantillonnage d’API
In Windows 11 26H2, this policy replaces AppDeviceInventory/TurnOffAPISamping (renamed (same title)).
Explanation
This policy controls the state of API Sampling. API Sampling monitors the sampled collection of application programming interfaces used during system runtime to help diagnose compatibility problems.
If you enable this policy, API Sampling will not be run.
If you disable or do not configure this policy, API Sampling will be turned on.
Cette stratégie contrôle l’état de l’échantillonnage d’API. L'échantillonnage d’API surveille la collection échantillonnée d'interfaces de programmation d'applications utilisées pendant l'exécution du système pour aider à diagnostiquer les problèmes de compatibilité.
Si vous activez cette stratégie, l’échantillonnage d’API ne sera pas exécuté.
Si vous désactivez ou ne configurez pas cette stratégie, l’échantillonnage d’API sera activée.
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\AppCompat- Value name
DisableAPISampling
| State | Value written |
|---|---|
| Enabled | REG_DWORD = 1 |
| Disabled | REG_DWORD = 0 |
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: AppDeviceInventory/TurnOffAPISampling
$k = 'HKLM:\Software\Policies\Microsoft\Windows\AppCompat'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'DisableAPISampling' -Value 1 -Type DWordDisable
# Disable: AppDeviceInventory/TurnOffAPISampling
$k = 'HKLM:\Software\Policies\Microsoft\Windows\AppCompat'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'DisableAPISampling' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": AppDeviceInventory/TurnOffAPISampling
$k = 'HKLM:\Software\Policies\Microsoft\Windows\AppCompat'
Remove-ItemProperty -Path $k -Name 'DisableAPISampling' -ErrorAction SilentlyContinue