Link to home
Start Free TrialLog in
Avatar of bramseyer
bramseyer

asked on

Window Repair Connection functinonality through API calls

Hello,

We have several computers using Netgear WG111 USB wifi cards.  Periodically they lose their connection.  Running the windows repair utility fixes the problem.  I have tried updating the autodisconnect registry setting with no luck.  I would like to create a VB .Net or C# program to run the 'repair connection' sequence programmatically.  Unfortunately, I cannot run a script that shells out to the command prompt due to permissions settings.  I would like to create a program with windows API calls.  Any ideas?
Avatar of windowsmt
windowsmt
Flag of United States of America image

While what you are asking can be DONE...

your problem sounds like it goes deeper. When you lose connection, have you checked the adapter status to see if you still have an IP address? Perhaps at lease renewal you are getting an APIPA address and not an address from the router or DHCP server. If that is the case, check for interference in your channels, try setting your preambles, power levels, etc.. to recommended static values.

I was using some Netgear adapters and had intermittent problems with a similar symptom. The problem was my router, not the adapters. I replaced the router/AP with a Sonicwall (or Cisco if you prefer) and my problem was immediately resolved.

But to answer your question, try this:
Create a shortcut:
rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl will run the applet...

Ultimately, all the repair does is the same thing NETSH does, but if you cannot shell out, you are effectively disabling and reenabling the adapter. Here is a site you should look at:

http://msdn.microsoft.com/en-us/library/aa394595(VS.85).aspx
Avatar of bramseyer
bramseyer

ASKER

When the connection is lost the Netgear client utility shows a connection to the access point with excellent signal strength.  The IP addresses are static.  If you go to a command prompt to try to ping the access point, the ping fails.  Repairing the connection, however, resolves the issue - at least for a while.  The AP is a cisco.  I don't think there is a problem with the AP.

I do not see anything in the WMI link provided to duplicate actions taken in a 'repair connection' command such as flushing the arp cache, flushing dns cache, etc.  Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of nffvrxqgrcfqvvc
nffvrxqgrcfqvvc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're the man.  Works great.