One of our regular readers complained that on his new physical Windows Server 2019 host, some internal devices (including NICs, RAID controller, CPU, and others) were showing up in the Safely Remove Hardware list. He is concerned that a user or administrator could accidentally click on the system tray and unplug a critical device from the host.
For internal SATA/SSD drives that show up as removable in the taskbar, disabling Hot Plug mode for the drive (controller) in the BIOS/UEFI may help. If this is not possible, use the TreatAsInternalPort
registry option to make Windows recognize SATA drives as internal rather than removable.
For some storage controllers, the Enable safely remove disk option may be available in the Policies tab of the driver properties.
devices.hotplug = "FALSE"
Another option is to simply hide the Safely Remove Hardware and Eject Media
icon from the Windows system tray.
To hide the Safely Remove Hardware icon in the system tray, make a change to the registry:
- Run the
regedit.exe
and go to the registry keyHKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray
- Change the Services parameter value from 31 (1F in HEX) to 29.
- To update the tray icons, run the
systray.exe
command.
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray /v Services
Then make the change to the registry:
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray /v Services /t reg_dword /d 29 /f && systray
This will hide the Safely Removal icon from the system tray. However, the value of this registry entry is automatically reset when the Windows user session is terminated.
Create a simple scheduler task that runs when any user logs in to hide the safely remove hardware icon for all users. Create this scheduled task with this command:
schtasks /create /tn "HideSafelyRemovalIcon" /tr "cmd.exe /c reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray /v Services /t reg_dword /d 29 /f && systray.exe" /sc ONLOGON
To safely remove one of the devices, run the command:
RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll
Select the device in the Safely Remove Hardware
dialog and click Stop. The device can then be safely unplugged.
Don’t worry about safely ejecting USB sticks. Starting from Windows 10 1809, the Quick Removal option is enabled by default for external storage devices (USB flash drives). So you can physically unplug the drive at any time without using the Safely Remove Hardware process. This will not damage the file system or cause data loss.