Configure wireless connection of Windows Vista from CLI with netsh wlan

David Davis

Surely one thing that you absolutely can configure wireless networking in Windows Vista using GUI but it's not always simple for most people. How to configure wirelessly from a command line utility? Let's find out why some people want to do this through the command line, and how to do it.

Why use the command line utility to configure the wireless connection?

One of you may initially wonder why it is necessary to do this and it is also a logical question. Some testify to the reason behind this issue listed as follows.

Use CLI when there is no GUI available - You never know when you will need to configure something (like a wireless network) from the command line because there is no GUI. This problem may occur for a number of reasons. With the commands introduced in this article, you will be carefully prepared.

Use CLI when scripting . It is possible that someday (it may be right now) when you need to write a script to connect to a wireless network. If you create that script, you need to know all the netsh wlan commands needed to perform this task within the script. For example, you can configure the wireless connection in a certain login scenario.

Because of its faster speed - Some network administrators might call it 'command line addiction' and we think it's also suitable for doing more tasks on the GUI. In fact, for users of command line utilities that are too familiar, it is possible to do many things in CLI faster than in the GUI.

What does Netsh WLAN offer?

The netsh wlan script set is only available in Windows Vista (not available in XP, 2003, or 2008 Server). So what can you do with these commands? This is a list:

  • Configure wireless security settings for this laptop or Windows computer.

  • Configure a wireless connection and network settings for this Windows laptop or computer. For example, you can configure a laptop when you log in, to connect, to secure your company's wireless network.

  • See the wireless group policy settings that have been applied to this Windows computer.

  • Connect with 'mixed mode' networks, you can connect to both WPA or WPA2 wireless networks.

  • Hide wireless networks from users - with netsh wlan, you can hide or prevent users from connecting to unwanted or potentially malicious wireless networks.

  • With that, let's see how it works .

    Create a profile and connect to Wireless LAN using netsh wlan

    Now that we have some uses that are possible with netsh wlan, the article will continue to show you how to use commands to perform a certain task on a real Windows Vista computer.

    To see all the options for netsh wlan, just type netsh wlan without any other options.

    Picture 1 of Configure wireless connection of Windows Vista from CLI with netsh wlan
    Figure 1: Netsh WLAN options

    To connect real, the first thing you need to do is create a profile. To pretend that a profile has worked, you need to create a saved XML file. On a Vista computer that already has a working wireless network, you need to run the following command:

    netsh wlan export profile name = "BOW" folder = C: UsersDavidwlan interface = "Wireless Network Connection"

    This command will create a file named:

  • Wireless Network Connection-BOW.xml

  • In the folder C: UsersDavidwlan

  • Picture 2 of Configure wireless connection of Windows Vista from CLI with netsh wlan
    Figure 2: An example of exporting Netsh wlan

    You then need to import this file into the system you want to add the profile to and connect to the wireless network.

    To create a profile to connect to a WLAN on a new computer, you need to do:

    C: UsersDavidwlan> netsh wlan add profile filename = "Wireless Network Connection-BOW.xml"

    (assuming that the directory has been changed to 'wlan')

    Picture 3 of Configure wireless connection of Windows Vista from CLI with netsh wlan
    Figure 3: Adding a new profile with Netsh WLAN

    You can choose to add this profile only to a certain wireless interface or to certain users.

    Once the profile has been added, you should verify with:

    netsh wlan show profiles

    Picture 4 of Configure wireless connection of Windows Vista from CLI with netsh wlan
    Figure 4: Show wireless profiles with Netsh wla

    You can see the settings for that profile with:

    netsh wlan show settings

    When you know you have a profile, you can use it to connect, like:

    netsh wlan connect ssid = 'mySSID' name = 'WLAN-Profil1'

    (Assume that the profile did not specify a connection automatically)

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

    Picture 5 of Configure wireless connection of Windows Vista from CLI with netsh wlan
    Figure 5: Results of connecting to WLAN

    If only one interface on the computer and security settings in the prifile are completely correct, you should connect to the wireless LAN.

    What else can Netsh WLAN do?

    Besides adding / deleting profiles and connecting or disconnecting wireless networks, Netsh WLAN can also do many other tasks.

    This is a list of things that this command will bring to you in addition to the above features:

    • Export wireless settings - By running netsh wlan dump and transferring it to a text file, you can create a script using this script to quickly get the wireless network adapter. configuration. When a wireless network is configured and connected, we recommend creating this WLAN configuration script with the following 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 up automatic configurations - When auto-configuration is enabled on a wireless interface, this interface automatically connects to its wireless profile. This is enabled by default. You can check the settings with netsh wlan show autoconfig option . You can also change the autoconfig settings with autoconfig enabled = no interface = 'Wireless Network Adapter'

    • Show and set blockednetworks - Wireless networks may be hidden or locked. You may want to have locked networks displayed on the available network list but listed 'blocked'. To hide these 'blocked' networks from the available network list, perform netsh wlan set blockednetworks display = hide

    • Show and set up if you are allowed to create wireless profiles for all users on your computer.

    • Show and set the profile order - When it comes to which profile will be used on the network interface if multiple profiles appear, the profile order will be sorted. With the current commands and profile settings, you can view or change the profile order from the command line utility.

    • Show and set whether to track the feature as 'on' or 'off' - Trace is a feature to record events for your wireless device. When you enable this feature with the netsh wlan command set yes yes , you can see the logs in % WINDIR% tracingwireless .

    Conclude

    The netsh wlan command is a very useful and very new script in Windows Vista. With these commands, you can easily add wireless profiles and connect to the wireless network from a command line utility - through scripts.

    ncG1vNJzZmismaXArq3KnmWcp51ksLC6xaKerqqVYsSqvsSlnKyrXZi8r7rEnKuip55ivKd51qKlnaenqHq3tdKtmGaeoqS6bq%2FLomSwoaSdeq%2Bx06yfZq%2Bclrs%3D