How to connect to adhoc network automatically in Vista?

Vista does not allow us to connect to adhoc networks automatically because of security issues. It is very very very annoy to me that every time I need to share the internet connection I have to connect the adhoc network manually. Therefore I decide to find an alternative way to do it for me automatically today, and luckily, I found a way to connect the adhoc automatically when I log on Windows Vista. The main idea is to use "task scheduler" to run netsh.exe to connect a created adhoc network for me when I log on.
1. create a adhoc network through "Network and sharing centre", remember to use WPA2 to protect your network. Remember the name of your network, here I take "sweethome" as an example.

2. search "task scheduler" through start menu and of cause run it.

3. select "action—>create basic task.." from file menu.

4. follow the wizard: a.Give what ever name you want to the task, press next button b. select "when I log on", next. c. select "start a program", next. d. "netsh.exe" to be in program/script box, "wlan connect name=sweethome" to be in arguments box, and leave "start in" box blank. e. finish it.
PS: the network name is case sensitive here, be careful with it.

5. Set delay of the task to 1 minute.

6. now you can test what you have done.

Enjoy the automatic connection of adhoc network.

PS: use netsh to export current wireless connections to xml files:
type "netsh.exe wlan export profile" in cmd.
the files will be saved to current user's folder.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License