NoDriveTypeAutorun registry key missing from Windows 10

0

I want to add a few lines to a script with the capacity to enable/disable the Autorun feature.

It's not a new concept. It's been covered countless times before, including here on StackExchange, and here by Microsoft.

The general consensus is, it's achieved by modifying the values of the following registry keys:

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

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutorun

This worked for me in the past with Windows7 (Ultimate/Professional), but these registry keys don't appear to be present on Windows10 (Enterprise). Is this normal? Have they been superseded?


I did a search for related keywords and found the following that seem like they could be relevant.

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\DisableAutoplay

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\AutorunINFLegacyArrival\
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers\AutorunINFLegacyArrival\

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\AutorunINFLegacyArrival\
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\MSAutoRun\
HKLM\SOFTWARE\Microsoft\PolicyManager\default\Autoplay\DisallowAutoplayForNonVolumeDevices
HKLM\SOFTWARE\Microsoft\PolicyManager\default\Autoplay\SetDefaultAutoRunBehavior
HKLM\SOFTWARE\Microsoft\PolicyManager\default\Autoplay\TurnOffAutoPlay
HKLM\SYSTEM\CurrentControlSet\Services\cdrom\
HKLM\SYSTEM\CurrentControlSet\Services\Disk\
HKLM\SYSTEM\CurrentControlSet\Services\sfloppy\

voices

Posted 2018-11-25T15:17:05.710

Reputation: 2 053

Answers

1

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

is still the correct registry key to disable Autorun.
This can be proven by going into the local policy editor and navigating to:
User / Computer Configuration -> Administrative Templates-> Windows Components -> Turn off Autoplay

Setting this policy to "CD-ROM and removable media drives" will change to the value 181 (0xb5), setting it to "All drives" will change the value to 255 (0xff).
The registry key most likely doesn't exist on your system because it has never been configured via group policies.

I can confirm that with the policy configured and the value set to 255 I no longer got a notification when inserting a DVD. This was tested with an Insider preview of Windows Server 2019 but should still apply to Windows 10.


Another possibility is to create the REG_DWORD

Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\DisableAutoplay
Value:1 = AutoPlay disabled
Value:0 = AutoPlay enabled


to disable AutoPlay for the current user. This is the same value that is used by the modern settings app located under Devices -> AutoPlay -> Use AutoPlay for all media and devices.

The advantage of using this method is that it should work on all versions of Windows 10 because its a native setting and no policy.
A mayor disadvantage may be that user will still be able to change the setting by them self since its no policy.
Also this method wont allow you to only block certain removable media while NoDriveTypeAutorun allows finer configurations.

User025

Posted 2018-11-25T15:17:05.710

Reputation: 378

If I just add it manually, will it have the desired effect? – voices – 2018-11-25T19:38:03.867

Yes that should work, most Group Policies literally just set a registry key. In my case Autorun got disabled immediately (no restart of explorer or Windows required) – User025 – 2018-11-25T19:50:11.740

Worth pointing out that some group policies only work on certain editions. So changing the associated registry key would not work in a case where the group policy wasn't applicable to the edition you are using. However, that isn't the case with this particular policy, but worth pointing out if you are trying to set group policies through the registry. – Ramhound – 2018-11-28T14:34:04.347

@Ramhound Are there any Group Policies that wont work in the Enterprise version of Windows? Thought they would all work for that version so I didn't mention that. – User025 – 2018-11-28T16:17:03.953

@User025 - There are indeed group policies that are ignored if enabled on Windows 10 Professional and are only applicable to Windows 10 Enterprise. Please read my original comment again. – Ramhound – 2018-11-28T16:23:10.210

I found this page: https://www.top-password.com/blog/4-ways-to-disable-windows-10-autoplay/ that says to set HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\DisableAutoplay to 1/0. Weird.

– voices – 2018-11-29T02:51:20.987

Hmm it seems like that registry value is the one used by the modern Windows 10 settings app. If you go into Devices -> AutoPlay and use the toggle switch to fully disable / enable AutoPlay this value will be used (disabling AutoPlay sets the value to 1 for me and enabling it again deletes the key), will edit my answer to reflect this – User025 – 2018-11-29T16:45:39.510