Home > Networking Tips > Wireless Networks > How to use Netsh WLAN to configure Windows Server 2008 and Windows Vista wireless connections from the CLI
Networking Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WIRELESS NETWORKS

How to use Netsh WLAN to configure Windows Server 2008 and Windows Vista wireless connections from the CLI


David Davis
01.22.2009
Rating: -4.25- (out of 5)


Wireless networks news, advice and technical information
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Configure wireless networking connections, specifically, Windows Server 2008 and Windows Vista wireless connections, from the command line interface (CLI) using Netsh WLAN. Figure out how to add or delete profiles and connect or disconnect to wireless networks without using a GUI interface. This tip, originally posted on WindowsNetworking.com, explains why this is important to learn, how to perform this function and explains other capabilities that Netsh WLAN allows you to do.

Sure, you can configure your wireless network connection in Windows Vista using the GUI. Although it is not always that simple, just about everyone has learned to do it. However, how about configuring wireless from the command line? Let us find out why you would want to do this, how you would do it, and then see it in action!

Why would you want to use the command line to configure wireless networking?
Some of you might be asking why you would want to do this in the first place and that is a logical question. Let me provide some justification for the reason behind this and help demonstrate the need to you.
  • Using the CLI when no GUI is available: You never know when you will need to configure something (like wireless) from the command line because no GUI is available. This could happen for a number of reasons. With the commands you learn in this article, you will be prepared.
  • Using the CLI when scripting: The day may come (or it may be here now) when you need to write a script to connect to a wireless network. If you create that script, you will need to know all the necessary Netsh WLAN commands needed to accomplish your task, inside the script. For example, you might want to configure wireless connectivity in a logon script.
  • Because it is faster: Some of us are just command line junkies and we enjoy using the command line to do things over the GUI. In fact, for some of you out there, you are fast enough at the command line that you can do things faster in the CLI than you can in the GUI.
What does Netsh WLAN ...

Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Wireless Networks
How to plan for 802.11n wireless LAN upgrades
Deploying 802.11n access points: Best practices
Rogue access points: Preventing, detecting and handling best practices
Persistent, secure connections for roaming WiMAX, 3G and 802.11x
Securing embedded 802.11n devices
802.11n's impact on WLAN security
Set up secure wireless networks with 802.11x, access points and bridges
How to avoid the WPA wireless security standard attack
IEEE 802.11w protects wireless LAN management frames
Measure wireless network performance using testing tool iPerf

Troubleshooting Wireless Networks
University tackles large-scale 802.11n wireless network management
Why is my network adapter not working after a Vista Business upgrade?
Meru reinvents wireless LAN troubleshooting and management
APs drop connection in WLAN configured as a wireless mesh network
How to plan for 802.11n wireless LAN upgrades
Vendors strive to automate wireless LAN troubleshooting and management
Fluke gets WLAN design, management, security cred with AirMagnet
Wi-Fi RTLS for WLAN management, location-based security, asset tracking
How radio frequency (RF) of microwaves alter wireless signal strength
Distributed antenna systems and WLAN: A network management burden
Troubleshooting Wireless Networks Research

Working With Servers and Desktops
What network loss testing tools/methods calculate dropped packets from a PC?
Do I have to disable DHCP on my router to create a DHCP server?
How can I replicate the services of Active Directory (AD) in ADC?
Top 10 reasons why computers do not have network access to each other
Troubleshooting -- 'Network Know-How' Chapter 17
Windows Server 2008 IP routing configuration: Static and dynamic RIPv2
Understand Windows tracert output to troubleshoot network connectivity
Test your TCP/IP protocol stack to troubleshoot network connectivity
Checking IP configuration to troubleshoot Windows network connectivity
Physical network security key to fighting low-tech threats

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
802.11a  (SearchNetworking.com)
home agent  (SearchNetworking.com)
iDEN  (SearchNetworking.com)
radio frequency  (SearchNetworking.com)
repeater  (SearchNetworking.com)
spectrum analyzer  (SearchNetworking.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


offer you?

The Netsh WLAN command set is only offered in Windows Vista (not in XP, 2003, or 2008 Server). So what can you do with these commands? Here is a list:

  • Configure wireless security settings for this Windows PC or laptop.
  • Configure wireless connectivity and network settings for this Windows PC or laptop -- for example, when logging in, you could configure a laptop to connect securely to the company wireless network.
  • View the wireless group policy settings that are applied to this Windows machine.
  • Connect to mixed mode networks -- for example, you can connect to either a WPA or WPA2 wireless network.
  • Hide wireless networks from end users -- with Netsh WLAN, you can hide from your end users or prevent end users from connecting to potentially malicious or just undesirable wireless networks.

With that, let us see how Netsh WLAN works.

Creating profiles and connecting to a Wireless LAN using Netsh WLAN
Now that we have seen some possible uses for Netsh WLAN, let me show you, on a real Windows Vista machine, how to use these commands to do certain tasks.

To view all the options for Netsh WLAN, simply type netsh wlan without any options and you will see this:

[IMAGE]
Figure 1: Netsh WLAN help options

To really connect, the first thing you need to do is create a profile. As the creation of a profile works off of an existing profile file that you have already saved, we first need to create our saved XML file.

On a Vista machine that already has a working wireless network, you would run the following command:

Netsh WLAN export profile name="BOW" folder=C:\Users\David\wlan interface="Wireless Network Connection"

This would create a file called:

  • Wireless Network Connection-BOW.xml
  • In folder C:\Users\David\wlan

[IMAGE]
Figure 2: Netsh WLAN export example

You would then import this file onto the system that you want to add the profile on and connect to the wireless network.

To create a profile to connect to the wireless LAN (WLAN) on the new machine, I would do this (assuming I changed directory into the "wlan" folder):

C:\Users\David\wlan> Netsh WLAN add profile filename="Wireless Network Connection-BOW.xml"

[IMAGE]
Figure 3: Adding a new profile with Netsh WLAN

Optionally, you could choose to add this profile only for a certain wireless interface or for certain users.

Once the profile is added, you should be able to verify that it is there with this:

Netsh WLAN show profiles

[IMAGE]
Figure 4: Showing wireless profiles with Netsh WLAN

You can see the settings for those profiles with the following command line:

Netsh WLAN show settings

Once you know that you have a profile, you can use that profile to connect, like this (assuming the profile did not specify auto-connection):

Netsh WLAN connect ssid="mySSID" name="WLAN-Profil1"

As you can see below, we are connected to the wireless network:

[IMAGE]
Figure 5: Results of connecting to the WLAN

If there is only one interface on the computer and the security settings in the profile are correct, at this point, you should be connected to the WLAN.

What else can Netsh WLAN do?
Besides just adding or deleting profiles and connecting or disconnecting to wireless networks, what else can Netsh WLAN do for you?

Actually, there are a number of other capabilities that Netsh WLAN can perform. Here is a list:

  • Dump wireless settings: By running Netsh WLAN dump and directing it to a text file, you can create a script that you could use to very quickly get your wireless network adaptor reconfigured. Once you have your wireless network configured and connected, I recommend creating this WLAN configuration script with this command:

    Netsh WLAN dump > mywlandump.txt

  • Add a filter: With the Netsh WLAN add command, you can also add a wireless network filter, as well as a profile.
  • Show and set autoconfig: When auto-configuration is enabled on a wireless interface that means the interface will automatically connect with its wireless profile. This is enabled by default. You can check your settings with Netsh WLAN show autoconfig. You can change your autoconfig settings with set autoconfig enabled=no interface="Wireless Network Adaptor"
  • Show and set blockednetworks: Wireless networks can be hidden or blocked. Perhaps you want the blocked networks to be shown in the list of available networks but listed as "blocked." To hide blocked networks from the list of available networks, use Netsh WLAN set blockednetworks display=hide
  • Show and set if you are allowed to create wireless profiles for all users on that machine: This one is self-explanatory, with the show command you can see if you are allowed.
  • Show and set the profile order: When it comes to which profile will be used on an interface if multiple profiles are present, the profile order is used. With the show and set profile commands you can simply view or change this profile order from the command line.
  • Show and set whether tracing is on or off: Tracing is essentially event logging for your wireless device. When you enable tracing with the command Netsh WLAN set tra yes you will find the log of those traces in %WINDIR%\tracing\wireless
Summary
The Netsh WLAN command is a new and very useful command set for Windows Vista. With these commands, you can very easily add wireless profiles and connect to wireless networks from a command line and through scripts.

About David Davis
David Davis has served as an IT Manager for over 15 years. He has a number of certifications including CCIE #9369, MCSE, CISSP, and VCP. Additionally, David has authored over one hundred articles, a number of video training courses including Windows XP, Wireless Networking, Linux Administration, ISA Server, A+ Certification, Microsoft Virtual Server, VMware Server & Workstation and VMware ESX Server. David publishes Cisco networking how-to articles and videos on his website, HappyRouter.com.

[IMAGE]

WindowsNetworking.com contains a wealth of networking information for administrators: Featuring information on how to setup and troubleshoot various networks of any size. Also includes a comprehensive archive of hundreds of reviewed networking software and hardware solutions. Frequently updated with articles and tips by a team of leading authors, it remains a favorite within the networking community.


Rate this Tip
To rate tips, you must be a member of SearchNetworking.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Networking Solutions for Business

Alcatel-Lucent Network Business Communications Solutions

About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts