You could click on the "safely remove" icon if your hardware is external.

Otherwise you could remove it from your hardware config if its internal.

You could design a simple script to do either task and call it a program if you wanted.

Beats me why you would want to do such a crazy thing though.. :)