Secret sauce that brings YouTube followers, views, likes
Get Free YouTube Subscribers, Views and Likes

21 One Line PowerShell Networking Commands

Follow
PowerShell Engineer

Check out my Udemy course PowerShell for Systems Engineers exclusively on Udemy: https://www.udemy.com/course/powershe...

Check out my book, PowerShell for Systems Engineers on Amazon:
https://www.amazon.com/PowerShellSys...

Retrieve the IP configuration of all network adapters.
GetNetIPAddress

Retrieve a list of all network interfaces and their associated IP addresses.
GetNetIPAddress | SelectObject Property InterfaceAlias, IPAddress | FormatTable

Send a single ICMP echo request to a remote host.
TestConnection ComputerName "microsoft.com"

Send a single ICMP echo request to a remote host while specifying counts
TestConnection ComputerName "microsoft.com" Count 1

Test if a specific port is open on a remote server.
TestNetConnection ComputerName "microsoft.com" Port 80

List all network adapters on the computer.
GetNetAdapter

Find MAC Address: Retrieve the MAC address of a network adapter.
GetNetAdapter | SelectObject Property Name, MacAddress

Display detailed information about a specific network adapter.
GetNetAdapter | WhereObject { $_.Name eq "Ethernet" } | FormatTable AutoSize

Show network statistics for a specific network adapter.
GetNetAdapterStatistics Name "Ethernet"

List open ports on your local computer.
GetNetTCPConnection State Listen

Find Active Network Connections: List active network connections with local and remote endpoints.
GetNetTCPConnection | WhereObject { $_.State eq 'Established' }

Show the DNS server addresses of the current network connection.
GetDnsClientServerAddress

Change DNS Servers: Set DNS server addresses for a network adapter.
SetDnsClientServerAddress InterfaceAlias "Ethernet" ServerAddresses ("8.8.8.8", "8.8.4.4")

Clear the DNS resolver cache to refresh DNS information.
ClearDnsClientCache

Perform a trace route to a destination IP address.
TestNetConnection ComputerName "microsoft.com" TraceRoute

Retrieve the IP address associated with a domain name (A record).
ResolveDnsName Name "powershellengineer.com" Type A

Get the mail server records (MX records) for a domain.
ResolveDnsName Name "powershellengineer.com" Type MX

Resolve an IP address to its associated domain name.
[System.Net.Dns]::GetHostEntry("192.168.1.1").HostName

Retrieve the Address Resolution Protocol (ARP) table.
GetNetNeighbor AddressFamily IPv4

List all Allow firewall rules.
GetNetFirewallRule | WhereObject { $_.Action eq "Allow" }

List all Allow firewall rules.
GetNetFirewallRule | WhereObject { $_.Action eq "Block" }


GitHub: GitHub: https://github.com/jimrtyler/
Twitter:   / jimrtyler  

posted by embamsfofp1