Click here to Skip to main content
15,899,025 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to restart usb ports useing C#?

What I have tried:

C#
how to restart usb ports useing C#?
.........................................
__________________________
Posted
Updated 4-Dec-16 1:48am
Comments
Mehdi Gholam 4-Dec-16 6:11am    
What do you mean by "restart"?
ahmedmohamednour 4-Dec-16 6:38am    
i have usb modem i wanna unplug and plug without remove it.
Kornfeld Eliyahu Peter 4-Dec-16 6:45am    
Have you searched CP?
https://www.codeproject.com/articles/21503/hardware-helper-library-for-c
prof_ahmed 4-Dec-16 7:20am    
it not working
it mean if there is any code to unplug/plug usb modem
i am also search for that
i tried devcon to restart and remove ,rescan
all of this not working

1 solution

Use WMI to eject the media, there are powershell examples if you Google and you can easily convert.

SushiHangover: PowerShell : Eject local or remote removable media[^]

Also lots of examples of using WMI in many languages and you can download the WMI Code Creator from Microsoft to play with.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900