Monday, September 12, 2011

Save and automatically connect to an ad-hoc network in Windows 7

This could probably be the ULTIMATE solution! Post a comment if it has helped you!

With each new Windows version, Microsoft has unfortunately chosen to make life harder for people who use ad-hoc networks to connect computers together without the use of a middleman (the router). In Windows Vista, one could choose to save the ad-hoc network one is connecting to.

But with Windows 7, not only is there no way of connecting automatically (well actually there is a shortcut for that, as below), but now one cannot save an ad-hoc network that one is connecting to. (One can only save an ad-hoc network one is creating in the host computer.)

The biggest annoyance is that every time one connects to an ad-hoc network as a guest, one has to enter the password (network key) again. All of these problems can be solved with the steps below.


To save an ad-hoc network and its network key on the guest computer (running Windows 7)

  1. Note down the SSID, security type, encryption type and the key of the ad-hoc network.
  2. Disconnect your connection to any wireless network and switch off/disable your wireless device. Turn on/enable your wireless device but don't connect to any network. (Thanks GK.)
  3. Click on the network icon in the taskbar.
  4. Click Open Network and Sharing Center > Manage Wireless Networks > Add.
  5. Click "Manually create a network profile". (This may look silly but we really are going to create an infrastructure network now.)
  6. Enter the network name (SSID), security type, encryption type (if any) and the key that you noted in step 1.
  7. Uncheck both checkboxes ("Start this connection automatically" and "Connect even if the network is not broadcasting".) [Note that you cannot have the connection start automatically. If you try to have it checked, step 10 will fail. A different way to start it automatically during system boot is described below.]
  8. Click Next > Close. Your connection must appear in the list with the icon suggesting infrastructure (two big screens connected to a tube). Don't worry about it.
  9. Click Start, type in "cmd" in the search box, press Enter.
  10. In the Command Prompt, type in "netsh wlan set profileparameter name=NetworkName ConnectionType=IBSS", exactly as shown, without quotes, except you must substitute NetworkName with the SSID (network name) of your ad-hoc network.
  11. If everything went well, you'll see that the icon has now changed to an ad-hoc icon (three small screens connected to each other) in the Manage Wireless Networks window.
  12. Turn on/enable your wireless device, and try connecting to the Ad-hoc network. You will notice that you no longer need to enter the network key.
To automatically connect to a saved ad-hoc network during Windows boot (can be applied to both guest and host computers running Windows 7)
  1. Click Start > point to All Programs > right-click Startup > click Open. (You may choose Open All Users instead if you prefer).
  2. Right-click an empty space and click New > Shortcut.
  3. Type in "netsh wlan connect NetworkName". Once again, NetworkName must be substituted with the SSID of your ad-hoc network.
  4. Click Next and enter a fancy name such as "Connect to NetworkName" or something like that.
  5. Click Finish and you're done. This shortcut will run when Windows starts up, giving you a very brief flash of the black command window, followed by your computer connecting to the ad-hoc network if it is available. Tip: You can also pin the shortcut in your taskbar or copy it to the desktop to easily connect to the network any time you want.
Note: You will probably need Administrator access to complete some of the steps above (in both procedures).

Random trivia: I kept typing ad-hock instead ad-hoc throughout this post.

13 comments:

  1. This totally works. I didn't need the first part because I was connecting Win 7 to XP(Win7 hosting), but the second part worked.

    To automatically connect to a saved ad-hoc network during Windows boot (can be applied to both guest and host computers running Windows 7)

    Thanks so much.

    ReplyDelete
  2. Absolutely brilliant :)
    But one small thing. 4) is not possible if wifi is disabled, so i had to keep it enabled. No idea how you managed to do this with wifi card disabled ;)

    Anyway, thank you!

    ReplyDelete
  3. Thanks for the heads-up. You're right, the option goes missing when I disable my Wireless Adapter (WiFi Card).

    ReplyDelete
  4. Brilliant! Works like a charm, thanks so much!

    ReplyDelete
  5. Works Fantastic! Only caveat was where the final shortcut had to reside to run at boot. It had to go down into the "Programs" "Startup" Folder.

    ReplyDelete
  6. Doug, you can put the shortcut anywhere, even multiple places. The purpose of putting it in the Startup folder is to make it run at boot (Windows startup to be specific), but you can obviously have a second shortcut on the Desktop or Quick Launch if you wish to run it at will.

    ReplyDelete
  7. You can also just "recreate" the ad-hoc connection on the "receiving" computer at step 5.
    Only caveat, you must ensure the ad-hoc connection is no longer available to connect to (i.e, put the first computer to sleep, or turn off your printer if it's an ad-hoc printer).
    Otherwise, it won't let you create the connection.
    This way, you actually don't even have to do step 2 at all, but it's important that you use the same name, security type and password.
    Once you complete 'creating' the ad-hoc network, the computer will say "waiting for users", just wake (or power on) your other devices, and TADA!
    And next time you try to connect, you won't need to enter a password anymore.

    ReplyDelete
  8. I just found a much simpler way!
    Just follow the "Manually Create" steps.... Then click "Copy this network profile to a USB flash drive.
    Go to the flash drive, the only directory should have a WSETTING file of type "WFC", as well as a text document of the same name. Editing the text document does nothing, but use notepad to edit the WFC one. Replace ESS with IBSS in that doc and save the file.
    Remove the wireless connection that you added in the network and sharing center, and then just remove/insert the flash drive. It will autorun and offer to install a working profile!

    ReplyDelete
  9. Thank you. You saved me from wasting time everyday. :)

    ReplyDelete
  10. Hi, it works with Windows 8 x64 too. Network center changed a bit, you need to choose
    Open Network and sharing center
    1. Setup new connection or network
    then
    2. Manually connect to a wireless network

    ReplyDelete
  11. Thanks ADTC, this totally solved my issue.

    ReplyDelete
  12. You're great! It works perfectly!

    ReplyDelete

Comments are moderated, and are usually posted within 24 hours if approved. You must have a minimum of OpenID to post comments.

LinkWithin

Related Posts with Thumbnails