The “Safely Remove Hardware and Eject Media” menu in the system tray might contain devices the user never intends to remove. These include USB network adapters, Type-C-connected monitors, SATA/SSD drives (displayed as removable media), USB sound cards, mouse devices, etc. An administrator can remove any device from the Safely Remove Hardware dialog.
- Open the Device Manager (
devmgmt.msc
) - Open the properties of the device you want to hide (TP-Link Wireless USB Adapter in this example)
- Go to the Details tab -> find the Hardware IDs property and copy the device ID. For example,
USB\VID_2357&PID_010C
- Open the registry editor and go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB
- Find and expand the registry key of your USB device
- Set the value of the Capabilities parameter to
60
(Hex) - If the device reg key has multiple nested subkeys, change the value of the Capabilities parameter in each of them.
- This will remove this USB network adapter from the Safely Remove list in the tray.
However, after a device restart, the value of the Capabilities registry parameter reverts to its original value. To automatically hide this device, create a scheduled task that changes this registry value at startup.
Create a new job using the Task Scheduler graphical snap-in (taskschd.msc
) or with the following command (replace the path to the registry key with your path):
schtasks /create /tn "Remove_TPLinkUSBAdapter_Safe_Removal" /sc ONSTART /ru SYSTEM /rl HIGHEST /tr "reg.exe add 'HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_2357&PID_010C\00E04C0001' /v Capabilities /t reg_dword /d 0x00000060 /f"
The specified device will now be automatically removed from the Safely Remove list.
If you want to safely remove and unplug this USB device, run the command:
RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll
This dialog can be used to safely stop the device if necessary.