How to automatically connect to Ad-Hoc network?
Beginning with Vista, Microsoft decided to be discriminatory to Ad-Hoc networks and you cannot connect to them automatically the same as to Infrastructure ones.
However, there's netsh.exe which can be started on a schedulable event like computer startup or user logon, to do the required task. Details in this blog post.
If you don't like setting up a schedule manually, consider getting a utility program that can automatically connect. A good example is Maxidix Wifi Suite.
The option with the scheduled task is better for servers and the Internet gateway computer, Maxidix Wifi Suite is better for end-user computers.