Guardiantorj Posted February 23, 2009 Share Posted February 23, 2009 I am looking to build or find a script that I can add a wireless network (WPA encryption) to a device. The wireless network is located an other building and is not used by a majority or my users but is used by maybe 25%. So I am looking at adding it to all wireless devices just to be safe. How would I go about doing this? I did find a Autoit script on another forum that looks like it runs through the motions but doesn't add anything (Code below). Is there something missing? If this script it not what I am looking for where do I start to making my own. I have made a few .bat files in the past but nothing with autoit yet. expandcollapse popup;Assign variables $ssid = ('Self Explanatory') $auth = ('Authentication mode here') $encrypt = ('Encryption style here') $NetKey = ('And just what is your password?') ; Setting the advanced setting in Network Properties Run(@ComSpec & " /c " & 'ncpa.cpl', "C:\WINDOWS\system32\dllcache", @SW_HIDE) ;Open the Network Connections dialog and activate the properties page of the Wireless Network Connection WinWait ( 'Network Connections') if NOT WinActive ( 'Network Connections') then WinActivate ( 'Network Connections') endif WinWaitActive ( 'Network Connections') Send('wireless') send ('{Appskey}') send ( 'r' ) ;Insure the Wireless Network Connection Properties page has focus and move to the appropriate tab $hwnd = WinGetHandle('Wireless Network Connection Properties') WinWait ( $hwnd, 'General' ) if NOT WinActive ( $hwnd, 'General' ) then WinActivate ( $hwnd, 'General' ) endif WinWaitActive ($hwnd, 'General' ) Sleep(500) ControlCommand($hwnd, 'General', 12320, 'TabRight', '') Sleep(500) ;Insure the Wireless Networks tab has focus WinWait ( $hwnd, 'Wireless Networks') if NOT WinActive ( $hwnd, 'Wireless Networks') then WinActivate ( $hwnd, 'Wireless Networks') endif WinWaitActive ( $hwnd, 'Wireless Networks') Sleep(500) ;Check to insure that Windows Wireless Zero Configuration is being used, then click on the Add button If Not ControlCommand($hwnd, 'Wireless Networks', 7024, 'IsChecked','') Then ControlCommand( $hwnd, 'Wireless Networks', 7024, 'Check', '') EndIf ControlFocus($hwnd, 'Wireless Networks', 7033) Sleep(500) ControlClick($hwnd, 'Preferred networks', 'Button7') ;Input the Wireless network properties information and save it $handle = WinGetHandle('Wireless network properties') ControlSetText($handle, "Association", "Edit1", $ssid) ControlCommand($handle, "Wireless network key", "ComboBox1", "SelectString", $auth) ControlCommand($handle, "Wireless network key", "ComboBox2", "SelectString", $encrypt) ControlSetText($handle, "Wireless network key", "Edit2", $Netkey) ControlSetText($handle, "Wireless network key", "Edit3", $Netkey) ControlClick($handle, "", "Button4") ;Close the Wireless Network Connection Properties window If WinExists('Wireless Network Connection Properties') Then WinActivate('Wireless Network Connection Properties') ControlFocus('Wireless Network Connection Properties', "Wireless Networks", 1) ControlClick('Wireless Network Connection Properties', 'Wireless Networks', 1) EndIf ;Close the Network Connections windows WinActivate('Network Connections') Send('!{F4}') Link to comment Share on other sites More sharing options...
exodius Posted February 23, 2009 Share Posted February 23, 2009 That script isn't going to be overly reliable, it pretty much uses functions that rely on specific windows and controls existing at a specific time, so it can be interrupted by a user pretty easily. So are you saying that the laptops connect to a wireless network that doesn't have a WPA key on it? And that your goal is to have them connect to one that does, and to no longer connect to the one that doesn't? Link to comment Share on other sites More sharing options...
Guardiantorj Posted February 23, 2009 Author Share Posted February 23, 2009 That script isn't going to be overly reliable, it pretty much uses functions that rely on specific windows and controls existing at a specific time, so it can be interrupted by a user pretty easily.So are you saying that the laptops connect to a wireless network that doesn't have a WPA key on it? And that your goal is to have them connect to one that does, and to no longer connect to the one that doesn't?They are currently attached to a wireless network that uses WEP. I need them to keep that one and add the one that is using WPA at the other location. Link to comment Share on other sites More sharing options...
exodius Posted February 23, 2009 Share Posted February 23, 2009 All the googling I've done has illustrated to me that this is a very fickle subject.You might try looking at this thread to see if any help lies therein. It looks like there's some other tools referenced that may do the trick. Link to comment Share on other sites More sharing options...
Guardiantorj Posted February 26, 2009 Author Share Posted February 26, 2009 I have looked at the link and found that the script that was previously done is the same as the one I was given above and it only adds an "Automatic" to the wireless configuration. Then there was mention of ENGL Zwlancfg which is not available right now. Is there another option out there or is there a way to edit the script above to add the wireless to my devices rather than just adding an "Automatic"? Link to comment Share on other sites More sharing options...
Guardiantorj Posted February 26, 2009 Author Share Posted February 26, 2009 (edited) I am starting to wonder if I am putting my data in properly for the variables....... in the script this is how I have been entering my variables. Is this correct? BEFORE: ;Assign variables $ssid = ('Self Explanatory') $auth = ('Authentication mode here') $encrypt = ('Encryption style here') $NetKey = ('And just what is your password?') AFTER: ;Assign variables $ssid = ('MYSSID') $auth = ('WPA-PSK') $encrypt = ('TKIP') $NetKey = ('MYKEY') I know this is not the best script to use but so far it is the only one that looks like it is doing anything for me at this time. The only problem I am having is that it is going through the motions but not adding the variable data to the fields and in tern is not adding the wireless network to my profile. Edited February 26, 2009 by Guardiantorj Link to comment Share on other sites More sharing options...
herewasplato Posted March 2, 2009 Share Posted March 2, 2009 @Guardiantorj,Welcome to the forums.See if the code in this post helps you out:http://www.autoitscript.com/forum/index.php?showtopic=90550 [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Guardiantorj Posted March 2, 2009 Author Share Posted March 2, 2009 @Guardiantorj,Welcome to the forums.See if the code in this post helps you out:http://www.autoitscript.com/forum/index.php?showtopic=90550WORKS GREAT!!!!! THANK YOU SO MUCH! Link to comment Share on other sites More sharing options...
James Posted March 2, 2009 Share Posted March 2, 2009 Bit of advice, variables don't have to be declared with () wrapping the value Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
herewasplato Posted March 3, 2009 Share Posted March 3, 2009 WORKS GREAT!!!!! THANK YOU SO MUCH!You are welcome. I've been meaning to do something like that for myself for a while...Bit of advice, variables don't have to be declared with () wrapping the value And I was surprised to see that they worked. I probably knew that at some point in time, but I do claim to be the most senile poster. :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now