Powershell script to remove hidden devices

Faisal Ahmed 21 Reputation points
2020-11-17T20:24:48.897+00:00

I implemented the SetupDiRemoveDevice() functionality. It removes the device from the system, but Windows still thinks the associated COM port is "in use". The next enumeration goes to the next higher COM number instead of the expected number.

How could I tell Windows to start reigstring the COM Ports from number such as 0.

Thanks.

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2020-11-18T09:20:16.847+00:00

    Hi,

    Try to remove the deive with PnPUtil pnputil /remove-device

    For your reference
    https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/pnputil

    Best Regards,
    Ian

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.