Last active
July 31, 2023 14:55
-
-
Save iamazeem/2d9cbc2e79878cabbfe85d704324be2e to your computer and use it in GitHub Desktop.
Get local listening ports as CSV on Windows
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
((Get-NetTCPConnection -State Listen | Select-Object -Property LocalPort | ConvertTo-csv -NoTypeInformation | Select-Object -skip 1) -join ",") -replace '"' | |
# List IPv4 listening local ports | |
(Get-NetTCPConnection -State Listen | Where-Object -Property LocalAddress -NotContains '::' | Select-Object -Property LocalPort | ConvertTo-csv -NoTypeInformation | Select-Object -skip 1 -Unique) -replace '"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment