|\ __________                          __   __                         __
         | |   __     |          _____ __    __\__/_|  |_ __ ___   _____   ___ |  |\_____     
         | |  /  \    |         /  _  \  \  /  /  |_    _|  /   \ /  _  \ /  _ \  |/  _  \    
         | |  \  /___ |        /  /_\  \  \/  /|  | |  |\|   /\  \  / \  \  / \   |  /_\  \   
         | |__/    _ \|        |  _____||    |\|  | |  | |  |\|  |  |\|  |  |\|   |  _____|\  
         | |___/\  \\_\        \  \____/  /\  \|  | |  | |  | |  |  \_/  /  \_/   |  \___ \|  
         | |    /   \_|         \_____/__/ /\__\__| |__| |__| |__|\_____/ \____/__|\_____/\   
         | |   / / \___|         \____\__\/  \__\__\|\__\|\__\|\__\\____\/ \___\\__\\____\/   
         | |__/_/_____|     
         |/                

Last changed: 21.11.2017

Establish Wlan connections via command line in Windows


The average user with small technical insight prefers graphical user interfaces to configure his operating system. This is why many configurations are hard to find in the command prompt in Windows.

windows wifi

As it could happen, that you end up only in a command prompt on a Windows host you could need to establish wireless connections without a GUI.

basic settings


configure interface

ipconfig /all
netsh int ip set address "local area connection" static 10.0.0.11 255.255.255.0 10.0.0.1 1
netsh int ip reset address "local area connection"
netsh int ip set dns "local area connection" static 10.0.0.2 primary

scan for networks

netsh wlan show networks
netsh wlan show networks mode=bssid

change MAC address from the command line


To change the MAC address of an interface in Windows the according key in the registry has to be added/changed. To identify the correct device you can search for example for the driver description and substitute the XXXX in the following commands.

reg query hklm\system\controlset001\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\ /v DriverDesc /s
reg add hklm\system\controlset001\control\class\{4d36e972-e325-11ce-bfc1-08002be10318}\XXXX /v NetworkAddress /t REG_SZ /d 123456789ABC

Windows will only accept a MAC address if the least-significant bit of the first byte is 0 (meaning unicast).

For the changed MAC Address to take effect the interface has to be restarted.

netsh interface show interface
netsh interface set interface name="WLAN" admin=disabled
netsh interface set interface name="WLAN" admin=enabled

manage connections


Settings of stored network connections can be read through their corresponding profiles with netsh. This way saved wifi passwords can be extracted.

netsh wlan show profiles
netsh wlan show profiles name=<PROFILE> key=clear
netsh wlan export profile name=<PROFILE> key=clear
netsh wlan add profile filename="file.xml"
netsh wlan connect name=<PROFILE>

create wireless access point


start hosted network

netsh wlan set hostednetwork mode=allow ssid=<SSID> key=<PASSWORD>
netsh wlan start hostednetwork

stop hosted network

netsh wlan stop hostednetwork
netsh wlan set hostednetwork mode=disallow