Managing wireless networks and network interfaces on Windows can be efficiently done using the netsh
command line tool. Here’s a comprehensive guide to the most useful netsh
commands for both wireless and wired network configurations.
Display All Wireless Interfaces
To see all wireless interfaces on your system:
netsh wlan show interfaces
This command displays details about the wireless interfaces, including their status, SSID, BSSID, and other relevant information.
Show Wireless Drivers
To list the wireless drivers installed on your system:
netsh wlan show drivers
This command helps you monitor driver versions, which is crucial since exploits can exist in drivers.
List Available Wireless Networks
To list all available wireless networks:
netsh wlan show networks
This command provides details about nearby wireless networks, including SSID, signal strength, and encryption type.
View Saved Network Profiles
To view profiles of networks saved on your machine:
netsh wlan show profiles
This command displays all the wireless profiles stored on your computer.
Connect to a Specific Network Profile
To connect to a specific wireless network profile:
netsh wlan connect name="ProfileName"
Replace "ProfileName"
with the name of the profile you want to connect to.
Export Profile Details
To export the details of a wireless profile to an XML file:
netsh wlan export profile name="ProfileName"
This exports the profile, including an encrypted version of the pre-shared key (PSK).
Show WiFi Password
To show the password for a WiFi profile:
netsh wlan show profile name="ProfileName" key=clear
Replace "ProfileName"
with the actual name of the WiFi profile. The password will be displayed under the Key Content
section.
Create and Start a Hosted Network
To set up a hosted network on Windows 7 or Server 2008 R2:
netsh wlan set hostednetwork mode=allow ssid=SomeSSID key=passphrase
Replace SomeSSID
with your desired network name and passphrase
with the network key.
To start the hosted network:
netsh wlan start hostednetwork
Your Windows machine will now advertise the network “SomeSSID,” allowing other devices to connect.
Managing Network Interfaces
List All Network Interfaces
To see a list of all network interfaces:
netsh interface show interface
This command lists all network interfaces, including enabled, disabled, and copied adapters.
List Network Interface Configurations
To see a list of NICs with their configured network settings:
netsh interface ip show config
This command provides detailed configurations of all network interfaces.
Set a Static IP Address
To set a static IP address:
netsh interface ip set address "ifname in quotes" static ipaddr subnetmask gateway metric
For example, to set the IP address on “Local Area Connection 3” to 10.0.0.100 with a /16 subnet mask and a 10.0.0.1 default gateway:
netsh interface ip set address "Local Area Connection 3" static 10.0.0.100 255.255.0.0 10.0.0.1 1
Configure a DNS Server
If you are setting a static IP for the first time, you will also need to configure a DNS server:
netsh interface ipv4 add dnsserver "Local Area Connection 3" address=8.8.8.8 index=1
Change Connection to DHCP
To change the connection back to DHCP:
netsh interface ip set address "Local Area Connection 3" dhcp
By utilizing these commands, you can efficiently manage and troubleshoot both wireless and wired networks on Windows, making network management tasks much simpler and more effective.