top of page

Using Microsoft’s netsh


I always encourage technical staff to get comfortable at the command line. This is for a lot of reasons:

  • More efficient than a gui

  • Learn about the device operation

  • Many times you can get information not available in the gui

  • A lot faster when working remotely over slow links

  • You can script common tasks

When teaching Wireshark, I spend time on tshark/dumpcap at the command line.

In this article I will spend some time on Microsoft’s netsh that I use regularly to modify my IPv4 settings. The reason is quite simple, if I have to make the same change multiple times, it is far more efficient to do it at the command line or in a batch file.

Even with the examples provided in the video, you can easily create a batch file that will accept input instead of statically assigning values.

Here is a summary of the commands in the video:

Display usage options and syntax

netsh /?

List of adapters

netsh interface ipv4 show interfaces

netsh interface ipv4 show config

netsh interface ipv4 show address

Show IPV4 global info

netsh interface ipv4 show global

To disable my Ethernet adapter labeled Killer

netsh int set int name=“Killer" admin=disabled

To enable my Ethernet adapter labeled Killer

netsh int set int name=“Killer" admin=enabled

Display TCP or UDP connections

netsh interface ipv4 show tcpconnections

netsh interface ipv4 show udpconnections

Set a static IP Address (10.44.10.22), Subnet Mask (255.255.255.0) and Gateway (10.44.10.1) on a specific interface (Killer) permanently (persistent)

** Use “” around your interface name if it has spaces in it.

netsh interface ipv4 set address name=Killer static 10.44.10.22 255.255.255.0 10.44.10.1 store=persistent

Set DNS Servers without a DNS check, the set dnsservers command supports only one server as argument

netsh interface ipv4 set dnsservers name=Killer source=static “8.8.8.8" primary

Set your adapter IPV4 and DSN back to DHCP

netsh interface ipv4 set address name=Killer source=dhcp

netsh interface ipv4 set dnsservers name=Killer source=dhcp

Enjoy


2,076 views

Recent Posts

See All
bottom of page