Windows 10, Emacs 25.1. If I want to safe eject usb flash drive I use this (on system tray)
Is it possible to do this in Emacs?
As it is recommended in this SuperUser answer, you can use a free command line tool, RemoveDrive, and launch the command from an emacs session or from within a shell buffer.
RemoveDrive prepares drives for "Safe Removal" by commandline. It works with drives only but not for other device types.