Prevent AutoPlay from remembering user choices.
Empêcher l’exécution automatique de mémoriser les choix des utilisateurs
Explanation
This policy setting allows you to prevent AutoPlay from remembering user's choice of what to do when a device is connected.
If you enable this policy setting, AutoPlay prompts the user to choose what to do when a device is connected.
If you disable or do not configure this policy setting, AutoPlay remembers user's choice of what to do when a device is connected.
Ce paramètre de stratégie vous permet d’empêcher la fonctionnalité Exécution automatique de mémoriser l’action choisie par l’utilisateur lorsqu’un périphérique est connecté.
Si vous activez ce paramètre de stratégie, la fonctionnalité Exécution automatique invite l’utilisateur à choisir l’action à entreprendre lorsqu’un périphérique est connecté.
Si vous désactivez ou ne configurez pas ce paramètre de stratégie, la fonctionnalité Exécution automatique mémorise l’action choisie par l’utilisateur lorsqu’un périphérique est connecté.
Registry
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\ExplorerHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer- Value name
DontSetAutoplayCheckbox
| 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.
Computer (HKLM)
Enable
# Enable: AutoPlay/DontSetAutoplayCheckbox
$k = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'DontSetAutoplayCheckbox' -Value 1 -Type DWordDisable
# Disable: AutoPlay/DontSetAutoplayCheckbox
$k = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'DontSetAutoplayCheckbox' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": AutoPlay/DontSetAutoplayCheckbox
$k = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
Remove-ItemProperty -Path $k -Name 'DontSetAutoplayCheckbox' -ErrorAction SilentlyContinueUser (HKCU)
Enable
Disable
Revert to "Not configured"