In effort to move away from old school habits of using i.e. nslookup instead of PS cmdlets I thought it would be beneficial if for reference I would reblog quite interesting article about replacement of those cmd into pure PowerShell cmdlets. Original article you can find under here
IPCONFIG
Used to get ip configuration.
Get-NetIPConfiguration Get-NetIPAddress Get-NetIPConfiguration Get-NetIPAddress | Sort InterfaceIndex | FT InterfaceIndex, InterfaceAlias, AddressFamily, IPAddress, PrefixLength -Autosize Get-NetIPAddress | ? AddressFamily -eq IPv4 | FT –AutoSize Get-NetAdapter Wi-Fi | Get-NetIPAddress | FT -AutoSize
PING
Check connectivity to target host.
Test-NetConnection Test-NetConnection www.microsoft.com Test-NetConnection -ComputerName www.microsoft.com -InformationLevel Detailed Test-NetConnection -ComputerName www.microsoft.com | Select -ExpandProperty PingReplyDetails | FT Address, Status, RoundTripTime 1..10 | % { Test-NetConnection -ComputerName www.microsoft.com -RemotePort 80 } | FT -AutoSize
NSLOOKUP
Translate IP to name or vice versa
Resolve-DnsName Resolve-DnsName www.microsoft.com Resolve-DnsName microsoft.com -type SOA Resolve-DnsName microsoft.com -Server 8.8.8.8 –Type A
ROUTE
Shows the IP routes (also can be used to add/remove )
Get-NetRoute New-NetRoute Remove-NetRoute Get-NetRoute -Protocol Local -DestinationPrefix 192.168* Get-NetAdapter Wi-Fi | Get-NetRoute
TRACERT
Trace route. Shows the IP route to a host, including all the hops between your computer and that host.
Test-NetConnection –TraceRoute Test-NetConnection www.microsoft.com –TraceRoute Test-NetConnection outlook.com -TraceRoute | Select -ExpandProperty TraceRoute | % { Resolve-DnsName $_ -type PTR -ErrorAction SilentlyContinue }
NETSTAT
Description: Shows current TCP/IP network connections.
Get-NetTCPConnection Get-NetTCPConnection | Group State, RemotePort | Sort Count | FT Count, Name –Autosize Get-NetTCPConnection | ? State -eq Established | FT –Autosize Get-NetTCPConnection | ? State -eq Established | ? RemoteAddress -notlike 127* | % { $_; Resolve-DnsName $_.RemoteAddress -type PTR -ErrorAction SilentlyContinue }
So happy moving into objectirezed world of PowerShell 🙂