0
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?
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
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.
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
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. – Sarah Weinberger – 2018-07-12T17:32:18.660
@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. – Sarah Weinberger – 2018-07-12T20:00:49.270