0

Where is the registry location, presumably under HKEY_CURRENT_USER, as the setting is user specific, for the Settings > Devices > AutoPlay > "Removable drive" option?

Windows Settings Devices AutoPlay Option

The user has the option to select:

  • Take no action
  • Open folder to view files (File Explorer) // Default setting
  • Import photos and videos (Dropbox)
  • Ask me every time
  • Configure storage settings (Settings)

If the setting is somewhere other than the registry, then where is that? Basically, I want to programmatically configure this option. The reason for my question here is that I already know how to work with the registry and file system. I just need to know where, hence more of a Super User question. Yes, my first thought is to post on Stack Overflow, however I am not asking a programming question, though I would use C# to do the programming, as I know that part. I am stuck on the physical location.

The other area, where an administrator (or user) can enable/disable the AutoPlay policy is with gpedit.msc. Basically, run (Windows key + R) gpedit.msc to launch the Local Group Policy Editor. from there, select

Local Computer Policy > User Configuration > Administrative Templates > Windows Components > AutoPlay Policies

gpedit.msc Showing the AutoPlay Policies

This avenue seems more complicated, but a possibility. Still, I would need to know where this setting is physically (I presume the registry as well).

I want to be able to programmatically, hence the "where", to temporarily disable launching File Explorer or take any other action on drives (USB, SATA, whatever) and then set the setting back to the original value once my task completes.

Just to be complete on all the areas, where a user can set AutoPlay settings, the traditional Control Panel is the third way. I am doing research on my problem and ran into this way. A user would go to the Windows Control Panel and select the View by Small Icons from the category dropdown and then select AutoPlay. I already found out via testing that setting the value in Settings automatically updates the Control Panel area. That means that both read from the same location dynamically, which I would presume is the registry.

Windows Control Panel AutoPlay Settings

UPDATE:

I saw this article, which states the registry entry NoDriveTypeAutoRun in the following key, but that has no effect on my Windows 10 Professional X64 system with all the latest updates. I changed the value in Settings and refreshed the registry to see no change.

HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explore

UPDATE 2

I found this article on how to disable AutoPlay programmatically. The article, although a programming topic, does answer my question, namely that the registry setting that I mentioned above, takes effect only after restarting Windows Explorer (logging off and then back on).

This article does indeed require a restart of Explorer, HOWEVER there is definitely an answer, as selecting a new option in Control Panel AutoPlay or the Settings/Devices/AutoPlay area is IMMEDIATE with no restart of Explorer. As such, there is a solution.

Maybe the solution is to write in 2 places: HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER. Whatever Settings does behind the scenes is what I wish to do, just I do not know what the Microsoft applet does.

ANSWER:

Based on the method exposed by the accepted answer, I got these two registry values.

Open Folder                     
39:21.9 SystemSettings.exe  13908   RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers\StorageOnArrival\(Default)   SUCCESS Type: REG_SZ, Length: 26, Data: MSOpenFolder
    MSOpenFolder                    
39:21.9 SystemSettings.exe  13908   RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival\(Default)   SUCCESS Type: REG_SZ, Length: 26, Data: MSOpenFolder
    MSOpenFolder                    

Take No Action                      
41:43.7 SystemSettings.exe  13908   RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers\StorageOnArrival\(Default)   SUCCESS Type: REG_SZ, Length: 30, Data: MSTakeNoAction
    MSTakeNoAction                  
41:43.7 SystemSettings.exe  13908   RegSetValue HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival\(Default)   SUCCESS Type: REG_SZ, Length: 30, Data: MSTakeNoAction
    MSTakeNoAction                  
2
  • I believe that I have my answer. There is none, as a registry change requires a restart of Windows Explorer, thereby making my "temporarily" a moot topic. There is another way programmatically, though. See Update 2 in my question for the link. I will add my accepted answer in a couple days, if all goes well. Jul 12, 2018 at 17:32
  • @Biswapriyo There is definitely an answer, so I revise my earlier comment. The obvious alluded me. Yes, the registry entry mentioned in my UPDATE 2 and first comment requires a reboot, HOWEVER making a change to the Settings or Control Panel is IMMEDIATE with no reboot or restarting Explorer, so there is an an answer. Jul 12, 2018 at 20:00

1 Answer 1

2

Where is the registry location for the Settings > Devices > AutoPlay > "Removable drive" option?

tl;dr: The registry location is:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers 
  • How to find the registry change? Here I use Process Monitor to monitor the registry change. Run Process Monitor (aka. ProcMon) as administrator → Press Ctrl+L to open Filter dialog box → Choose the filter options as "Operation --- is --- RegSetValue --- then --- include" → then Add button → OK. The screenshot is as follows:

ProcMon_RegSetValue

  • The registry settings are listed below. This format is a Windows Registry file:
Windows Registry Editor Version 5.00

;Disable AutoPlay
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers]
"DisableAutoplay"=dword:1

;Take No Action
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSTakeNoAction"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSTakeNoAction"

;Open folder to view files (File Explorer)
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSOpenFolder"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSOpenFolder"

;Ask me every time
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSPromptEachTime"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSPromptEachTime"

;Configure storage settings (Settings)
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\CameraAlternate\ShowPicturesOnArrival]
@="MSStorageSense"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlersDefaultSelection\StorageOnArrival]
@="MSStorageSense"

These registry settings can be easily converted in C/C++ RegSetValue() or in C# RegistryKey.SetValue Method. The Dropbox option is handled by that program itself. Find those registry with ProcMon as above. See more details in this article.

2
  • @Bizwapriyo I will put the actual registry values in the question. How did you get that nice output from ProcMon? I got an endless stream of data in the main table and it took me a bit to find the actual values. I had to hide a lot of stuff. Thank you for the detailed answer and instruction. You taught me a a bit about Mark's ProcMon.exe tool. I met Mr. Ponytail once years ago. Jul 12, 2018 at 21:51
  • Ya, ProcMon is powerful tool. For this case, you may right click on "SystemSettings.exe" and choose "Include SystemSettings.exe" option. Then it will show registry changes only from Settings app.
    – Biswapriyo
    Jul 13, 2018 at 1:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .