Q. What are some PowerShell IP troubleshooting cmdlets?
A. Below are some common cmdlets to help troubleshoot IP (along with their cmd equivalents)
- Get-NetAdapter | View all the adapters (ipconfig /all - MAC information)
- Get-NetIPAddress (optional -InterfaceAlias "<interface name>" also -AddressFamily IPv4) | View IP configuration (ipconfig.exe)
- Test-Connection <IP> | Runs a connectivity test (similar to ping)
- Test-NetConnection <IP> | Checks connectivity including DNS lookup and connectivity
- Test-NetConnection -TraceRoute <IP> | Shows the path to a target (tracert)
- Resolve-Dnsname <DNS name> | Performs a DNS lookup (nslookup)
- Register-DnsClient | Registers IP with DNS servers (ipconfig /registerdns)
- Get-NetTCPConnection | View network connections (netstat)
Remember regular PowerShell can be used on the pipeline to manipulate the returned data. For example:
Get-NetIPAddress –AddressFamily IPv4 | Select-Object IPAddress, Type
Get-NetTCPConnection | Group State, RemotePort | Sort Count | FT Count, Name -Autosize
Get-NetTCPConnection | ? State -eq Established | FT -Autosize
0 comments
Hide comments