Forum Discussion

Rickenx's avatar
Rickenx
Copper Contributor
Jun 28, 2022

Is there a script to uninstall COM ports?

I would like to know if there is a script that can be used to uninstall COM port, because sometimes the port loses communication and I need to uninstall and restart the computer manually. Would it be possible to use this script in powershell with the task scheduling feature?

1 Reply

  • ArthurRodriguez's avatar
    ArthurRodriguez
    Copper Contributor

    Use the PowerShell command

    Get-PnpDevice -Class Ports | Where-Object {$_.FriendlyName -like ‘*COM*’} | Disable-PnpDevice -Confirm:$false

    to uninstall COM ports.

Resources