0% found this document useful (0 votes)
263 views

Network Powershell Commands

The document provides instructions for using PowerShell to manage network adapters and perform various networking tasks like getting IP configuration information, enabling and disabling adapters, renaming adapters, setting static IP addresses, configuring DNS servers, pinging destinations, performing traceroutes, checking open ports, resolving hostnames, replacing route and netstat commands, and creating network adapter teams. Key cmdlets include Get-NetAdapter, Get-NetIPAddress, Set-NetIPAddress, Test-NetConnection, Resolve-DnsName, Get-NetRoute, Get-NetTCPConnection, and New-NetLbfoTeam.

Uploaded by

Archangel Gab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
263 views

Network Powershell Commands

The document provides instructions for using PowerShell to manage network adapters and perform various networking tasks like getting IP configuration information, enabling and disabling adapters, renaming adapters, setting static IP addresses, configuring DNS servers, pinging destinations, performing traceroutes, checking open ports, resolving hostnames, replacing route and netstat commands, and creating network adapter teams. Key cmdlets include Get-NetAdapter, Get-NetIPAddress, Set-NetIPAddress, Test-NetConnection, Resolve-DnsName, Get-NetRoute, Get-NetTCPConnection, and New-NetLbfoTeam.

Uploaded by

Archangel Gab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Get the IP Configuration (ipconfig with PowerShell)

Get-NetIPConfiguration
List all Network Adapters

Get-NetAdapter
Get a spesific network adapter by name

Get-NetAdapter -Name *Ethernet*

Get more information VLAN ID, Speed, Connection status

Get-NetAdapter | ft Name, Status, Linkspeed, VlanID

Get driver information

Get-NetAdapter | ft Name, DriverName, DriverVersion, DriverInformation,


DriverFileName
Get adapter hardware information. This can be really usefull when you need to know
the PCI slot of the NIC.

Get-NetAdapterHardwareInfo
Disable and Enable a Network Adapter

Disable-NetAdapter -Name "Wireless Network Connection"


Enable-NetAdapter -Name "Wireless Network Connection"
Rename a Network Adapter

Rename-NetAdapter -Name "Wireless Network Connection" -NewName "Wireless"

Get IP and DNS address information

Get-NetAdapter -Name "Local Area Connection" | Get-NetIPAddress


Get IP address only

(Get-NetAdapter -Name "Local Area Connection" | Get-NetIPAddress).IPv4Address


Get DNS Server Address information

Get-NetAdapter -Name "Local Area Connection" | Get-DnsClientServerAddress


Set IP Address

New-NetIPAddress -InterfaceAlias "Wireless" -IPv4Address 10.0.1.95 -PrefixLength


"24" -DefaultGateway 10.0.1.1
or if you want to change a existing IP Address

Set-NetIPAddress -InterfaceAlias "Wireless" -IPv4Address 192.168.12.25


-PrefixLength "24"
Remove IP Address

Get-NetAdapter -Name "Wireless" | Remove-NetIPAddress


Set DNS Server

Set-DnsClientServerAddress -InterfaceAlias "Wireless" -ServerAddresses


"10.10.20.1","10.10.20.2"
Set interface to DHCP

Set-NetIPInterface -InterfaceAlias "Wireless" -Dhcp Enabled


Clear DNS Cache with PowerShell
You can also manage your DNS cache with PowerShell.

List DNS Cache:

Get-DnsClientCache
Clear DNS Cache

Clear-DnsClientCache

How to Ping with PowerShell. For a simple ping command with PowerShell, you can use
the Test-Connection cmdlet:

Test-Connection thomasmaurer.ch
There is an advanced way to test connection using PowerShell

Test-NetConnection -ComputerName www.thomasmaurer.ch


Get some more details from the Test-NetConnection

Test-NetConnection -ComputerName www.thomasmaurer.ch -InformationLevel Detailed


Ping multiple IP using PowerShell

1..99 | % { Test-NetConnection -ComputerName x.x.x.$_ } | FT -AutoSize

Tracert with PowerShell

Test-NetConnection www.thomasmaurer.ch –TraceRoute

Use PowerShell to check for open port

Test-NetConnection -ComputerName www.thomasmaurer.ch -Port 80


Test-NetConnection -ComputerName www.thomasmaurer.ch -CommonTCPPort HTTP

NSlookup using PowerShell:

Resolve-DnsName www.thomasmaurer.ch
Resolve-DnsName www.thomasmaurer.ch -Type MX -Server 8.8.8.8

How to replace Route command with PowerShell

Get-NetRoute -Protocol Local -DestinationPrefix 192.168*


Get-NetRoute -InterfaceAlias Wi-Fi

New-NetRoute –DestinationPrefix "10.0.0.0/24" –InterfaceAlias "Ethernet" –NextHop


192.168.192.1

How to replace NETSTAT with PowerShell

Get-NetTCPConnection
Get-NetTCPConnection –State Established

Create a new NIC Teaming (Network Adapter Team)

New-NetLbfoTeam -Name NICTEAM01 -TeamMembers Ethernet, Ethernet2 -TeamingMode


SwitchIndependent -TeamNicName NICTEAM01 -LoadBalancingAlgorithm Dynamic

You might also like