Jump to content

Repair wireless network (WinXP)


Recommended Posts

Hi,

I have an old PC set up in my home as a printer server - i.e. a printer is connected to it and shared through the network.

This PC doesn't have a monitor, mouse or keyboard since it's not needed - if I want to configure something, I use VNC.

However, when the PC boots, it frequently fails to connect to our (wireless) home network.

I want to write a script which checks every 5 Minutes whether it can connect to the internet (thus being in the network) and if not, "repair" the wireless network using the Windows Wireless repair utility. It'll then check again every 45secs to ensure it worked, and if it has finally worked, it'll check again every 5 minutes.

OK, so far so good... But how do I run the repair utility? I mean the one you get when you right-click the wireless symbol in the tray and click "Repair".

Is there a way of running that with AutoIt? I can't do it with clicking somewhere specific because whenever I boot, the tray icon is somewhere else.

Thanks in advance

--WhiteAvenger

Link to comment
Share on other sites

Haven't found the repair command but maybe stopping/starting the wireless zero config service

on the cmdline will do the trick - can't check atm, sorry.

'sc stop wzcsvc' (wait) 'sc start wzcsvc'

P.S. Won't give you the repair screen though

Edited by whim
Link to comment
Share on other sites

Hi,

I have an old PC set up in my home as a printer server - i.e. a printer is connected to it and shared through the network.

This PC doesn't have a monitor, mouse or keyboard since it's not needed - if I want to configure something, I use VNC.

However, when the PC boots, it frequently fails to connect to our (wireless) home network.

I want to write a script which checks every 5 Minutes whether it can connect to the internet (thus being in the network) and if not, "repair" the wireless network using the Windows Wireless repair utility. It'll then check again every 45secs to ensure it worked, and if it has finally worked, it'll check again every 5 minutes.

OK, so far so good... But how do I run the repair utility? I mean the one you get when you right-click the wireless symbol in the tray and click "Repair".

Is there a way of running that with AutoIt? I can't do it with clicking somewhere specific because whenever I boot, the tray icon is somewhere else.

Thanks in advance

--WhiteAvenger

I believe you can also do most of the functions using the "ipconfig" command-line tool. This is a batch file that I've used (saved as "ipfix.cmd"):

@echo off
ipconfig /release *local*
ipconfig /release *wirel*
ipconfig /flushdns
ipconfig /renew *wirel*

Either convert to AutoIt, or have your script call the batch file.

Run "ipconfig /?" in a command prompt for more info.

Link to comment
Share on other sites

What about this, which works for an English version of XP 32-bit (I use a similar script to invoke the properties of my network-connection to set file and printer sharing on or off depending on the network I'm using):

Global $WinShell= ObjCreate("shell.application"), $ControlPanel = 3, _
$NetConTitle    = 'Network Connections', _  ; Name of the window you see whenever you open "Network Connections" from the Control Panel
$NetWorkName    = 'Wireless Network Connection'; Name of the connection you'd wish to invoke a function on

While 1
    While StringLeft(@IPAddress1, 4) = '169.' Or @IPAddress1 = '0.0.0.0'    ;As long as the adaptor has an "auto-configuration" address or no IP-addres
        RepairConnection()                                  ;Repair the connection
    WEnd
    Sleep(300 * 1000)                                       ;300 seconds (5 minutes)
WEnd

Func RepairConnection()
    For $ControlPanelItem in $WinShell.NameSpace($ControlPanel).Items
        If $ControlPanelItem.Name = $NetConTitle Then
            For $NetConnection In $ControlPanelItem.GetFolder.Items
                If $NetConnection.Name = $NetWorkName Then ExitLoop(2)
            Next
        EndIf
    Next
    $NetConnection.InvokeVerb('Re&pair')                                    ;Invoke the function
    If WinWaitActive('Repair ' & $NetworkName, 'finished repairing', 45) Then _;As soon as the repairment took place or 45 seconds have passed
        Send('{TAB}{ENTER}')                                                ;Close the window by sending {ALT}{ENTER}
EndFunc

Edited by maroesjk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...