en-US windows computer user

Set the default behavior for AutoRun

Verified with Windows 11 25H2 — updated on July 30, 2026

Windows 11 25H2

Supported on: At least Windows Vista

Path in the GPO console

Computer Configuration\Administrative Templates\Windows Components\AutoPlay Policies

Description

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.

Registry

HKLM Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
HKCU Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

More options available

Options

Default AutoRun Behavior
NoAutorun enum
  • Do not execute any autorun commands -> 1 (default)
  • Automatically execute autorun commands -> 2

MDM / Intune (CSP)

Device ./Device/Vendor/MSFT/Policy/Config/Autoplay/SetDefaultAutoRunBehavior
User ./User/Vendor/MSFT/Policy/Config/Autoplay/SetDefaultAutoRunBehavior
DeviceUser Since Windows 10, version 1703 [10.0.15063] and later Official mapping (Microsoft Learn)

Microsoft Learn documentation Mapping data: Microsoft Learn (CC BY 4.0)

Export Builder

BETA

Configure the state, scope and options, then generate .reg, PowerShell, Intune and SCCM outputs — or add the setting to a multi-setting collection.

These exports write the registry — this is not a managed GPO.

Scope

.reg file

Windows Registry Editor Version 5.00

; Exported from gporais.com
; Policy: Set the default behavior for AutoRun
; State: Enabled
; Scope: Computer (HKLM)
; Supported on: At least Windows Vista

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoAutorun"=dword:00000001
More formats (PowerShell, Intune, SCCM)

PowerShell

# Exported from gporais.com
# Policy: Set the default behavior for AutoRun
# State: Enabled
# Scope: Computer (HKLM)
# Supported on: At least Windows Vista

$path = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'NoAutorun' -Value 1 -Type DWord

Building a multi-setting collection? Add this setting and generate combined .reg / PowerShell / GPO scripts.

Open the Builder

Embed this policy on your site

What to embed
Theme

Adds one script line: the theme follows your site’s appearance and the height fits the content. If your site blocks scripts, the embed follows the visitor’s system theme.

Preview