Open in the explorer

Set the default behavior for AutoRun

Définir le comportement par défaut du programme Autorun

Type
Computer and user
GPO path
Computer Configuration › Policies › Administrative Templates › Windows Components › AutoPlay Policies User Configuration › Policies › Administrative Templates › Windows Components › AutoPlay Policies FR: Configuration ordinateur › Stratégies › Modèles d'administration › Composants Windows › Stratégies d’exécution automatiqueFR: Configuration utilisateur › Stratégies › Modèles d'administration › Composants Windows › Stratégies d’exécution automatique
Supported on
At least Windows Vista FR: Au minimum Windows Vista
ADMX file
AutoPlay.admx
Internal name
AutoPlay/NoAutorun

Explanation

This policy setting sets the default behavior for Autorun commands.

Autorun commands are generally stored in autorun.inf files. They often launch the installation program or other routines.

Prior to Windows Vista, when media containing an autorun command is inserted, the system will automatically execute the program without user intervention.

This creates a major security concern as code may be executed without user's knowledge. The default behavior starting with Windows Vista is to prompt the user whether autorun command is to be run. The autorun command is represented as a handler in the Autoplay dialog.

If you enable this policy setting, an Administrator can change the default Windows Vista or later behavior for autorun to:

a) Completely disable autorun commands, or
b) Revert back to pre-Windows Vista behavior of automatically executing the autorun command.

If you disable or not configure this policy setting, Windows Vista or later will prompt the user whether autorun command is to be run.

French text from Windows 11 26H2

Ce paramètre de stratégie définit le comportement par défaut des commandes Autorun.

Les commandes Autorun sont habituellement stockées dans des fichiers autorun.inf. Elle lancent souvent le programme d’installation ou d’autres routines.

Dans les versions antérieures à Windows Vista, lors de l’insertion d’un média contenant une commande Autorun, le système exécute automatiquement le programme sans intervention de l’utilisateur.

Ce comportement présente un risque important pour la sécurité, car du code peut être exécuté sans que l’utilisateur en soit conscient. Le comportement par défaut dans Windows Vista notamment consiste à demander à l’utilisateur d’exécuter ou non la commande Autorun. La commande Autorun est représentée en tant que gestionnaire dans la boîte de dialogue Exécution automatique.

Si vous activez ce paramètre de stratégie, un administrateur peut modifier le comportement de Windows Vista ou d’une version ultérieure pour que la commande Autorun effectue les opérations suivantes :

a) Désactiver complètement les commandes Autorun, ou
b) Rétablir le comportement antérieur à Windows Vista qui consiste à exécuter automatiquement la commande Autorun.

Si vous désactivez ce paramètre de stratégie ou ne le configurez pas, Windows Vista ou une version ultérieure demande à l’utilisateur d’exécuter ou non la commande Autorun.

Use cases

Sets the default behaviour for AutoRun commands (autorun.inf files): do not run, prompt, or run automatically. Disabling AutoRun removes a classic malware propagation vector through removable media.

It is a baseline staple in many security baselines; the "do not execute any autorun commands" value is the safest.

Microsoft sources: Threats and Countermeasures Guide: External Storage Devices · Issues after Autoplay is disabled in Group Policy

Registry

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
Value name
not defined in the ADMX

Enable / disable values: not defined in the ADMX (see the options below).

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/NoAutorun
$k = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# Default AutoRun Behavior
# Possible options:
#   Do not execute any autorun commands = 1
#   Automatically execute autorun commands = 2
Set-ItemProperty -Path $k -Name 'NoAutorun' -Value 1 -Type DWord

Disable

# Disable: AutoPlay/NoAutorun
# No value is written in the "Disabled" state (nothing defined in the ADMX)

Revert to "Not configured"

# Revert to "Not configured": AutoPlay/NoAutorun
$k = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
Remove-ItemProperty -Path $k -Name 'NoAutorun' -ErrorAction SilentlyContinue

User (HKCU)

Enable

Disable

Revert to "Not configured"

Options (1)

LabelControlRegistry valueREG typeConstraints / details
Default AutoRun BehaviorComportement par défaut de la commande AutorunNoAutorun_DropdownDrop-down listenumNoAutorunREG_DWORD
Default choice (UI): #0
LabelValue
Do not execute any autorun commandsREG_DWORD = 1
Automatically execute autorun commandsREG_DWORD = 2

Availability