Jump to content

Recommended Posts

Posted

Hey all. I have a very very locked down set of XP Pro machines with a very limited desktop and I need to give the logged in user the ability to run something that essentially does the same things as right clicking on a wireless connection and selecting repair. Can anyone help? I have seen some nice wireless scripting that pulls wireless info, but my search didnt yeild much on running a repair.

Thanks in advance...it never ceases to amaze me that AutoIT is still free and this forum is brilliant.

Posted (edited)

You can use windows shellobject with .verbs and .doit to repair, disable, enable ..etc the connection.

This crude example will hopefully be enough for you to work it out and build it the way you see fit.

(the example has no proper error checks and as stated it's in it's crudest form)

_RepairConnection("Wireless Network Connection")

; $sName = the name of the adapter as shows in the Network Connections folder under Name.
Func _RepairConnection($sName)
    Local Const $NETWORK_CONNECTIONS = 0x31
    Local $objShell, $objFolder
    $objShell = ObjCreate("Shell.Application")
    If Not IsObj($objShell) Then Return SetError(1, 0, 0)
    $objFolder = $objShell.NameSpace($NETWORK_CONNECTIONS) 
    If Not IsObj($objFolder) Then Return SetError(2, 0, 0)
    For $objItem in $objFolder.Items
        If $objItem.Name = $sName Then
            For $oVerb In $objItem.Verbs
                If $oVerb.Name = "Re&pair" Then $oVerb.DoIt
            Next
        EndIf
    Next
    Sleep(1000)
EndFunc

Edit: This requires Win 2000 or higher. (XP is fine, Vista I have no idea)

Cheers

Edited by smashly

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
  • Recently Browsing   0 members

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