Désactiver l’échantillonnage d’API
Turn off API Sampling
Dans Windows 11 26H2, cette stratégie remplace AppDeviceInventory/TurnOffAPISamping (renommée (même titre)).
Explication
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.
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.
Registre
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\AppCompat- Nom de la valeur
DisableAPISampling
| État | Valeur écrite |
|---|---|
| Activé | REG_DWORD = 1 |
| Désactivé | REG_DWORD = 0 |
PowerShell
Commandes PowerShell qui écrivent dans le registre ce que la stratégie écrirait. Les valeurs entre chevrons (<…>) sont à remplacer.
Écrire directement dans le registre contourne la stratégie de groupe : si une GPO gère cette valeur, elle sera réécrite au prochain gpupdate ; sinon la valeur reste en place (effet « tatouage »). Préférez une GPO ou, en local, LGPO.exe. Exécutez PowerShell en administrateur pour HKLM. Certaines stratégies demandent un redémarrage ou gpupdate /force.
Activer
# Activer : 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 DWordDésactiver
# Désactiver : 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 DWordRevenir à « Non configuré »
# Revenir à « Non configuré » : AppDeviceInventory/TurnOffAPISampling
$k = 'HKLM:\Software\Policies\Microsoft\Windows\AppCompat'
Remove-ItemProperty -Path $k -Name 'DisableAPISampling' -ErrorAction SilentlyContinue