C# – Connect and disconnect USB devices programmatically


I need to connect and disconnect USB devices, such as flash drives, in a programmatical manner, without unplugging and re-plugging the device.

Is there any way to do it in a C# Windows application?

Best Solution

You might want to look at some related questions:

Both of the approaches mentioned in the answers are readily translatable to C#.