scorona85
scorona85

Reputation: 121

Remove ghost com port programmatically C#

There is a way to Removes ghost devices from your system in C#? I have try with "ManagementObjectSearcher" with "From Win32_Device" or "Win32_PnPEntity" but with not success. Thanks

Element to remove

With powerShell there is this command:

Get-PnpDevice -class "Ports" -status unknown

I have to execute it in c# and I have to remove the "unknown" devices

Upvotes: 0

Views: 315

Answers (1)

mene
mene

Reputation: 382

You can loop between every port at the startup and try to open it, so you can identify which one exist and it's available. Related answer

Upvotes: 1

Related Questions