Skip to content

Instantly share code, notes, and snippets.

@vpetrigo
Created November 30, 2021 13:18
Show Gist options
  • Save vpetrigo/5292b760806f5387a2541c42dbc02435 to your computer and use it in GitHub Desktop.
Save vpetrigo/5292b760806f5387a2541c42dbc02435 to your computer and use it in GitHub Desktop.
Remove stale USB COM and LPT ports in Windows
Get-PnpDevice -Class "Ports" | select -property "Status","InstanceId" | where -property "status" -value "Unknown" -EQ | foreach { pnputil /remove-device $_.InstanceId }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment