homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10)
Forum Library, Charter, Moderators: bill

Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10) Forum

Ad Hoc Connection restart
Internet keeps dropping out

 5:59 am on Feb 22, 2010 (gmt 0)

Hi -
I'm running a laptop and a pc with shared internet from a USB modem over adhoc connections on W7 and it all works splendidly, EXCEPT, that sometimes the adhoc connection drops out.

I start it using a batch file in "Startup" set to:
C:\Windows\System32\netsh.exe wlan connect name=AdHoc ssid=AdHoc interface="Wireless Network Connection"

Is there a way to run this script using a DUN instead of a batch file so that it will auto-restart when it drops out?



 11:00 pm on Feb 25, 2010 (gmt 0)


Is this question in the wrong place? or is it just too boring to bother with?

;-) - Rhys


 5:29 am on Feb 26, 2010 (gmt 0)

I guess nobody knows how to run your script using a DUN instead of a batch file. I did look around, but couldn't find anything.


 9:46 am on Feb 26, 2010 (gmt 0)

Thanks Bill, I guess the wording was too limiting?

How about:

How can I auto-restart a dropped AdHoc connection?


 5:43 pm on Feb 26, 2010 (gmt 0)

I looked at this but could find nothing to help. However, as a general point, using abbreviations such as DUN doesn't help to illicit replies - my best guess was dial-up-network (which doesn't seem to make sense but I suppose there are similarities).

I briefly played with setting up an ad-hoc network a while back but did not pursue it - have you checked if there is an auto-reconnect option hiding under an advanced settings page?

In order to auto-run a script for this purpose, you must first be able to detect that the connection has dropped out. That requires a monitoring program or an event-triggered approach. Is this the part you need help with?



 11:03 pm on Feb 26, 2010 (gmt 0)

Thank you Kaled for your interest. The reason I want to do this using Dial Up Networking is that there is provision in there to detect dropped connections, and to re-connect.

I was hoping the answer lay in something fairly simple like using the Internet connection wizard, but adding in the nstsh connection script (see above) at some point - something like using an adsl connection where there is no phone number, but code like *99## instead.

Unfortunately I am using Windows 7 which tries to do everything for you and doesn't have places where you can add in stuff like XP used to have.



 2:39 am on Feb 27, 2010 (gmt 0)

Dialup Networking is using different hardware isn't it? I always thought that was setup through your phone modem, not your Ethernet or wireless connection. I haven't setup dialup in years, so I may be a bit rusty.


 12:20 pm on Feb 27, 2010 (gmt 0)

Assuming your USB modem has an ethernet connection (most do) then the simplest solution is to order a wireless router. I use a TP-link model - they're inexpensive and mine has worked faultlessly for two years.

This has the advantage that the sharing computer can be switched off when not in use. In the first year, this might save enough electricity to pay for the router. It also includes a hardware firewall (useful, but maybe not the best).



 7:07 am on Mar 1, 2010 (gmt 0)

@Kaled, I already have a router, G604T DLINK, but it has no USB slot, hence the search for an AdHoc solution.

Have just got it to work using the G604 as a router, and the main PC as the internet connection. Will post the settings if I can duplicate what I did.


 10:54 pm on Mar 2, 2010 (gmt 0)

Problem Solved! :)

Found a way to use an old ADSL DLINK router with the USB modem (3G stick + Internet Connection Sharing + Windows 7).

1. Set up ICS on the computer with the USB stick. Share it. (ICS Default = and

2. Set up the router with DHCP and NAT disabled and a fixed IP in the same range, like and the mask

3. Connect the rest of your household computers to the router network.

Tip: Set the "Default Gateways" to the router IP ( to avoid the network showing up as an "Unidentified Network"

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10)
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved