Remove all the COM ports
PS C:\Users\ubuntu> Get-PnpDevice | Where-Object { $_.Class -eq "Ports" -and $_.Present -eq $false } | ForEach-Object { pnputil /remove-device $_.InstanceId }
Microsoft PnP 公用程式
正在移除裝置: FTDIBUS\VID_0403+PID_6011+09001550C\0000
已順利移除裝置。
a. Get-PnpDevice: 獲取所有裝置列表。
b. $_.Class -eq "Ports": 篩選出屬於「連接埠 (COM 和 LPT)」的裝置。
c. $_.Present -eq $false: 篩選出「目前不在線上(隱藏)」的裝置。
d. pnputil /remove-device: 強制移除這些裝置
Remove all the Modem ports
PS C:\Users\ubuntu> Get-PnpDevice | Where-Object { $_.Class -eq "Modem" -and $_.Present -eq $false } | ForEach-Object { pnputil /remove-device $_.InstanceId }
Microsoft PnP 公用程式
正在移除裝置: USB\VID_1BC7&PID_1031&MI_02\6&170AB803&1&0002
已順利移除裝置。2
沒有留言:
張貼留言