Tuesday, January 20, 2015

Stop External USB Hard Drive from Auto-Playing in Windows 7

The instructions on the internet are very long, and confusing and for some reason this can only be done through the registry.

To disable it one drive letter at a time:


This chart above is important and the key to this process. It is in binary code. 
Copy it into notepad for editing. Under the letter you want to disable, change it from 0 to 1.
0 means enabled. 1 means disabled.

  1. Open calculator. Click the menu "View | Programmer".
  2. On the left of the 4 bubbles, select "Bin" (for binary). 
  3. Now copy and paste the binary numbers from notepad into calc.exe
  4. Now click the bubble "Hex" (to convert to hex).
  5. Copy the result (or remember).
Now open regedit.exe and navigate to: 


On the right side, you should see a bunch of stuff already there.

Click the menu "Edit | New > DWORD (32-bit) Value"
Give it the name: NoDriveAutoRun
Enter the value from calc.exe (and make sure the bubble is on Hex)

To disable it for one Type of drive:

There is another method that disables it for an entire type:
(Removable (USB flash or HD) / Non-Removable (HDD) / Network / CD-DVD / RAMdisk).

The process is the same as above, in the same registry location but the entry is called:

Using the chart below, change the appropriate column from 0 to 1, and follow steps 1-5 shown above.


Bit numberBit patternDrive type
200000100Disk that can be removed from the drive (such as a floppy disk or USB flash drive)
300001000Disk that cannot be removed from drive (usually a hard disk)
400010000Network drive
500100000CD/DVD drive
601000000RAM disk
Notice the 3rd column is Bit #2 because binary starts with 0. Bit #1 does not seem to exist.
(not listed above, Bit #0 and Bit #7 controls Disables AutoRun on drives of unknown type.)

The default is 0x00000091 (91 Hex) or "145" (Dec) or "1001 0001" (Binary)
Meaning by default, unknown types and network drives are disabled, and everything else is enabled.

Cheat Sheet:
91AutoRun is enabled for CD/DVD drives and USB flash drives
95AutoRun is disabled for USB flash drives
B1AutoRun is disabled for CD/DVD drives
B5AutoRun is disabled for CD/DVD drives and USB flash drives

To disable it for everything:

Follow the process for "type" and use the same key ( NoDriveTypeAutoRun )

If you want to disable all the types listed above:
Use the bit-mask "01111100" in binary, or "7C"(Hex) or "124" (Dec)

If you want to disable EVERYTHING (even drives with an unknown type):
The bit-mask "11111111" in binary, or "FF" (Hex) and "255" (Dec) 

Just fill in this hex code into the NoDriveTypeAutoRun entry.
Theoretically Autoplay would never show up again.

Sub-Note:  The NoDriveTypeAutoRun subkey value in registry has higher priority than the setting in the "Control Panel > AutoPlay Options".
So if AutoRun for a drive is disabled via NoDriveTypeAutoRun then you can not enable it by using the Control Panel. 

Side Note: Apparently, you can edit the same location in HKEY_LOCAL_MACHINE to make it machine wide, instead of per-user.

No comments: