lawson23 Posted September 19, 2011 Share Posted September 19, 2011 (edited) Please I would like to create a script that will configure my wireless settings for all my pc's my org. I have ways of deployment and also want to put this into my scripted deployment for new machines. I have not used autoit in like 4 years and I'm not a programmer I'm a network admin. I have been reviewing MattyD's scripts () he created but my one question and problem is I really don't understand where to begin as he does not have like a walk through. 1. what is the difference between the a and b files? Which file do I edit? Is there any newb information on how to walk through getting started using his stuff to do what I need? I have a basic wpa tkip configuration I need to setup. Windows XP SP3SSID: WSLANNetwork Authentication: WPA-PSKData Encryption: TKIPNetwork key: 123456789samplePassword12345789NO IEEE 802.1x authenticationyes - connect when this network is in range. Please any help in getting started with this would be very grateful. Until I can get more help with MattyD's stuff I have modified and used:Not perfect but it does exactly what I need it to do. Edited September 20, 2011 by lawson23 Link to comment Share on other sites More sharing options...
MattyD Posted October 4, 2011 Share Posted October 4, 2011 (edited) Hey mate, what is the difference between the a and b files?Use the 'a' file. The functionality is the same for both versions but the syntax is much more friendly in wifi33a... (the b version is only for back compatability) Which file do I edit?There is a small mistake in wifi33a that brakes the _Wlan_SetProfileUserDataXML function. We are not using 802.1x authentication - so don't worry about it. What you need to do is take a copy of wifi33a.au3 and put it into the same directory as your script. Then here is some code: #include "wifi33a.au3" ;exposes the functions defined in the UDF to your script _Wlan_StartSession() Local $Profile[8] ;see the PDF for more profile options and samples $Profile[0] = "WSLAN" $Profile[3] = "WPA-PSK" $Profile[4] = "TKIP" $Profile[7] = "PasswordGoesHere" Local $ErrorMsg = _Wlan_SetProfile($Profile) If @error Then MsgBox(0, "Profile Import", "The profile import failed because:" & @CRLF & @CRLF & $ErrorMsg) Else MsgBox(0, "Profile Import", "The profile import was successful") EndIf _Wlan_EndSession() Good luck, Matt Edited October 4, 2011 by MattyD Link to comment Share on other sites More sharing options...
lawson23 Posted December 1, 2011 Author Share Posted December 1, 2011 (edited) Matt,So do I basically input my password where you got "PasswordGoesHere"Complile this little bit of code that you generated as a EXE and include that exe and the wifi33a.au3 or does the compile include the wifi33a.au3 and then I end up with a single exe?Also thank you I will start testing this out to see if I can also figure it out myself if I don't hear from you.===============================================This does not appear to work as I keep getting:"The profile is invalid according to the schema."I created a wifi.au3 in the same dir as wifi33a.au3 copied your script above and modified the password. Then compiled to a exe and get the above message when test running. Edited December 1, 2011 by lawson23 Link to comment Share on other sites More sharing options...
MattyD Posted December 14, 2011 Share Posted December 14, 2011 (edited) Hey man, While you are in Scite, just press F5 to run your script while you are debugging. when all is done hit F7 to compile. The Include directive literally inserts the entire contents of the included file at that point. So in short, yes you will only have one executable at the end. I've double checked, and that code is working fine for me on my XP machine. At best guess I would say there is something funny happining with your key. a few ideas: - Try using the dummy key from my first post (If it doesn't like that we have deeper issues.) - Double check your key is legal. I'd try to create the profile manually and see if it is accepted. - Bypass the automatic key type detection. add $Profile[6] = "Pass Phrase" where you are defining your profile. (The other type is "Network Key") - add this line ConsoleWrite(_Wlan_GenerateXMLProfile($Profile) & @CRLF) before _Wlan_EndSession to see what you are actually passing to the API. Let me know how you do. all the best, Matt Edited December 14, 2011 by MattyD Link to comment Share on other sites More sharing options...
lawson23 Posted January 3, 2012 Author Share Posted January 3, 2012 Matty, tried the $Profile[6] with pass phrase and network key and nothing changed. I added the line right before _wlan_endsession() that you said but nothing happens and it still gives the same error. as far as the network key it is valid we use it everyday. Here is my code with a few mods #CS 12/01/2011 - Version 1 ----------------------------------------------------------------- ----------------------NATIVE WIFI FUNCTIONS---------------------- --------------------------For WinXP SP3-------------------------- ----------------------------by MattyD---------------------------- ----------------------------------------------------------------- #CE #include "wifi33a.au3" ;exposes the functions defined in the UDF to your script _Wlan_StartSession() Local $Profile[8] ;see the PDF for more profile options and samples $Profile[0] = "WSLAN" $Profile[3] = "WPA-PSK" $Profile[4] = "TKIP" $Profile[6] = "Pass Phrase" $Profile[7] = "ljj[59P{K~2X^2}@c?Vg8rZX4=JYnxZR{,:BqR%?Bl5)&`)@>(k<cpIq]ycx10" Local $ErrorMsg = _Wlan_SetProfile($Profile) If @error Then MsgBox(0, "Profile Import", "The profile import failed because:" & @CRLF & @CRLF & $ErrorMsg) Else MsgBox(0, "Profile Import", "The profile import was successful") EndIf ConsoleWrite(_Wlan_GenerateXMLProfile($Profile) & @CRLF) _Wlan_EndSession() Link to comment Share on other sites More sharing options...
MattyD Posted January 4, 2012 Share Posted January 4, 2012 Jeez man, what ever happened to "BobTheDog" for a password (granted it is perfectly legal - so congrats, you found a bug!) FYI, the SetProfile function takes the parameters you have specified in the array, converts it into an XML string that Windows understands, and then feeds it to the API. A quick bit of googling has revealed the characters <, >, and & (plus a couple more) are illeagal in an XML string type - therein lies our problem. Pop these lines right after you've defined your password and bob's your uncle. $Profile[7] = StringReplace($Profile[7], "&", "&") $Profile[7] = StringReplace($Profile[7], "<", "<") $Profile[7] = StringReplace($Profile[7], ">", ">") cheers, Matt Link to comment Share on other sites More sharing options...
lawson23 Posted January 5, 2012 Author Share Posted January 5, 2012 (edited) Works like a Charm!!! Thanks MattyD! Any information on if this will ever work in Windows 7 x64? I have not tested it yet but we are in the process of getting ready to start moving to 7 deployment. Edited January 5, 2012 by lawson23 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