PowerShell Networking Cmdlets

CommandDescriptionExample
Get-NetAdapterRetrieves network adapter informationGet-NetAdapter
Get-NetIPAddressRetrieves IP address configurationGet-NetIPAddress
Get-NetRouteDisplays the IP routing tableGet-NetRoute
Test-NetConnectionTests network connectivity to a remote computerTest-NetConnection -ComputerName google.com
Resolve-DnsNamePerforms DNS name resolutionResolve-DnsName google.com
Get-DnsClientServerAddressRetrieves DNS server addressesGet-DnsClientServerAddress
Get-NetTCPConnectionDisplays active TCP connectionsGet-NetTCPConnection
Get-NetUDPEndpointDisplays active UDP endpointsGet-NetUDPEndpoint
Get-NetFirewallRuleRetrieves firewall rulesGet-NetFirewallRule
New-NetFirewallRuleCreates a new firewall ruleNew-NetFirewallRule -DisplayName “Allow Port 80” -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow
Set-NetFirewallRuleModifies an existing firewall ruleSet-NetFirewallRule -DisplayName “Allow Port 80” -Enabled True
Remove-NetFirewallRuleRemoves a firewall ruleRemove-NetFirewallRule -DisplayName “Allow Port 80”
Get-NetIPConfigurationDisplays IP configuration for all network adaptersGet-NetIPConfiguration
Set-NetIPAddressModifies IP address settingsSet-NetIPAddress -InterfaceIndex 12 -IPAddress 192.168.1.100 -PrefixLength 24
New-NetIPAddressAdds a new IP address to an interfaceNew-NetIPAddress -InterfaceIndex 12 -IPAddress 192.168.1.100 -PrefixLength 24 -DefaultGateway 192.168.1.1
Remove-NetIPAddressRemoves an IP address from an interfaceRemove-NetIPAddress -InterfaceIndex 12 -IPAddress 192.168.1.100
Get-NetNeighborDisplays the Address Resolution Protocol (ARP) cacheGet-NetNeighbor
Clear-DnsClientCacheClears the DNS client cacheClear-DnsClientCache
Get-NetConnectionProfileRetrieves network connection profilesGet-NetConnectionProfile
Set-NetConnectionProfileSets properties of a network connection profileSet-NetConnectionProfile -InterfaceIndex 12 -NetworkCategory Private
Disable-NetAdapterDisables a network adapterDisable-NetAdapter -Name “Ethernet”
Enable-NetAdapterEnables a network adapterEnable-NetAdapter -Name “Ethernet”
Restart-NetAdapterRestarts a network adapterRestart-NetAdapter -Name “Ethernet”
Get-NetAdapterBindingRetrieves network adapter bindingsGet-NetAdapterBinding -Name “Ethernet”
Enable-NetAdapterBindingEnables a specific binding on a network adapterEnable-NetAdapterBinding -Name “Ethernet” -ComponentID ms_tcpip
Disable-NetAdapterBindingDisables a specific binding on a network adapterDisable-NetAdapterBinding -Name “Ethernet” -ComponentID ms_tcpip
This table covers a wide range of networking commands in PowerShell, from basic connectivity testing to more advanced configuration tasks. Remember to run PowerShell as an administrator for commands that modify system settings.