What is the command line that starts sharing the internet connection from LAN over Wi-Fi? I think it allows to set a specific network name and a password.

I remember it from some techie talk on a podcast, but they gave no specifics, and my friends told me it exists, though they couldn't remember it on the spot.

  • Why the requirement for it being command line only? Will normal Internet Connection Sharing not work for you? Commented Apr 10, 2013 at 3:19
  • I'm only interested in the command line execution of this feature. I'm sure other people will find it interesting too. Commented Apr 10, 2013 at 4:05

1 Answer 1



For some reason, this won't work in Windows 8:

The hosted network couldn't be started.
The group or resource is not in the correct state to perform the requested operation.

I have not found a solution to this problem. The answer remains valid for Windows 7, though.

This feature is called hosted networks. On a Wi-Fi enabled computer running Windows 7, use the following commands in an elevated command prompt:

  • netsh wlan set hostednetwork mode=MODE ssid=SSID key=KEY keyusage=KEYUSAGE
    Changes access point settings. mode can be allow or disallow, specifying whether the access point is enabled. ssid is the name of the network; key is the encryption key used for accessing the network. keyusage can be persistent or temporary, indicating whether the key is kept or discarded after one use (the default is persistent). Note that WPA2-AES is used.
  • netsh wlan start hostednetwork
    Starts the access point.
  • netsh wlan stop hostednetwork
    Stops the access point.
  • netsh wlan show hostednetwork
    Shows the status of the access point.

To allow Internet access through the access point, open the properties for the adapter that provides the Internet connection under Change adapter settings in the Network and Sharing Center, then enable Internet Connection Sharing to the Microsoft Virtual WiFi Miniport Adapter that is providing the wireless connection, usually Wireless Network Connection 2.

Note that the access point created using this procedure uses infrastructure mode. For more information and technical details about hosted networks, see http://msdn.microsoft.com/en-us/library/windows/desktop/dd815243%28v=vs.85%29.aspx.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .