Turn off Autoplay: registry value NoDriveTypeAutoRunUserHKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Policy ID
Autorun
Scope
Computer Configuration, User Configuration
Supported on
At least Windows 2000
Source
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (version 1.0)
Category
Windows Components › AutoPlay Policies

Registry

NoDriveTypeAutoRun

REG_DWORDUserComputer
Enabled value
Depends on the option value
Element
Turn off Autoplay on:
Options
ItemStored value
CD-ROM and removable media drives181
All drives255
Apply with .reg · CMD · PowerShell
UserPer-account setting
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]

; Options (use only one)
; CD-ROM and removable media drives
"NoDriveTypeAutoRun"=dword:000000b5
; All drives
"NoDriveTypeAutoRun"=dword:000000ff
CMD
:: Options (use only one)

:: CD-ROM and removable media drives
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDriveTypeAutoRun" /t REG_DWORD /d 181 /f
:: All drives
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDriveTypeAutoRun" /t REG_DWORD /d 255 /f
PowerShell
# Common: create the key
New-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null

# Options (use only one)
# CD-ROM and removable media drives
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDriveTypeAutoRun' -PropertyType DWord -Value 181 -Force | Out-Null
# All drives
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDriveTypeAutoRun' -PropertyType DWord -Value 255 -Force | Out-Null
ComputerMachine-wide setting
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]

; Options (use only one)
; CD-ROM and removable media drives
"NoDriveTypeAutoRun"=dword:000000b5
; All drives
"NoDriveTypeAutoRun"=dword:000000ff
CMD
:: Options (use only one)

:: CD-ROM and removable media drives
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDriveTypeAutoRun" /t REG_DWORD /d 181 /f
:: All drives
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDriveTypeAutoRun" /t REG_DWORD /d 255 /f
PowerShell
# Common: create the key
New-Item -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Force | Out-Null

# Options (use only one)
# CD-ROM and removable media drives
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDriveTypeAutoRun' -PropertyType DWord -Value 181 -Force | Out-Null
# All drives
New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -Name 'NoDriveTypeAutoRun' -PropertyType DWord -Value 255 -Force | Out-Null