NetSH – Connect to Wireless Network Without Existing Profile

netshwireless-networking

I'm currently coding a network app based on NetSH. Is there a way to connect to a wlan network without having to create a wlan xml profile?

Sorry if the question is unclear or doesn't belong here…
Thanks.

Best Answer

Is there a way to connect to a wlan network (using netsh) without having to create a wlan xml profile?

No. This is not possible using netsh.

In order to use netsh wlan connect the profile name is required (not optional).


netsh wlan connect /?

Usage: connect [name=]<string> [[ssid=]<string>] [[interface=]<string>]

Parameters:

Tag             Value
ssid          - SSID of the wireless network.
name          - Name of the profile to be used in connection attempt.
interface     - Name of the interface from which connection is attempted.

Remarks:

Connect to the wireless network given by ssid using the specified profile. Connection is attempted from the specified interface unless there is only one available interface on the system, in which case, the interface parameter can be omitted.

Parameter profile name is required but ssid is optional. If only one SSID exists in the profile, then this SSID is used to connect. If there are multiple SSIDs in the profile, then parameter ssid is required.

Parameter interface is required if there are two or more available interfaces on the system. When interface is specified, it cannot be a wildcard name.

If the specified interface is already connected to a wireless network, this command will first disconnect from the currently connected network, then attempt to connect to the new network. However, if these two networks are the same this command simply returns success and does nothing.

Examples:

connect name=Profile1 ssid=SSID1
connect name=Profile2 ssid=SSID2 interface="Wireless Network Connection"
Related Question