Last active
September 26, 2018 15:29
-
-
Save Chirishman/fafafe6c034010dd9173f45b6a5e5bd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$AllSerial = [System.IO.Ports.SerialPort]::getportnames() | |
$RemoveNonUSBSerial = Get-PnpDevice -FriendlyName '* (COM*' -Class 'Ports' | ?{$_.DeviceID -notmatch '^BTHENUM'} | |
$FriendlyNames = ($RemoveNonUSBSerial.FriendlyName) -join '|' | |
$USBComPorts = $AllSerial | ?{$FriendlyNames -match "\($_\)"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment