Skip to content

Instantly share code, notes, and snippets.

@netrunn3r
Last active April 1, 2021 11:07
Show Gist options
  • Save netrunn3r/9c519801828772df5d012caaf8892ed8 to your computer and use it in GitHub Desktop.
Save netrunn3r/9c519801828772df5d012caaf8892ed8 to your computer and use it in GitHub Desktop.
Daily commands in PS

Network

netstat

Get-NetTCPConnection
Get-NetTCPConnection -State Listen,Bound
Get-NetTCPConnection -State Listen,Bound | ? LocalAddress -ne 127.0.0.1
Get-NetTCPConnection -LocalPort 1025
Get-NetTCPConnection -LocalPort 1025 | select local*,remote*,state,@{Name="Process";Expression={(Get-Process -Id $_.OwningProcess).ProcessName}}

ip address

Get-NetIPAddress | Format-Table
Get-NetIPAddress -AddressFamily IPv4 | Format-Table

interface info

Get-NetAdapter
Get-NetIPInterface
Get-NetIPInterface -AddressFamily IPv4 | sort InterfaceIndex

route

Get-NetRoute -AddressFamily IPv4
Find-NetRoute -RemoteIPAddress 8.8.8.8

ping

Test-NetConnection 8.8.8.8

tracert

Test-NetConnection 8.8.8.8 -TraceRoute

system port reservation

netsh int ipv4 show dynamicport tcp
netsh int ipv4 set dynamicport tcp start=10000 num=1000
netsh int ipv4 show excludedportrange protocol=tcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment