Jump to content

Wireless Help


lawson23
 Share

Recommended Posts

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 SP3

SSID: WSLAN

Network Authentication: WPA-PSK

Data Encryption: TKIP

Network key: 123456789samplePassword12345789

NO IEEE 802.1x authentication

yes - 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 by lawson23
Link to comment
Share on other sites

  • 2 weeks later...

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 by MattyD
Link to comment
Share on other sites

  • 1 month later...

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 by lawson23
Link to comment
Share on other sites

  • 2 weeks later...

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 by MattyD
Link to comment
Share on other sites

  • 3 weeks later...

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

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], "&", "&amp;")
$Profile[7] = StringReplace($Profile[7], "<", "&lt;")
$Profile[7] = StringReplace($Profile[7], ">", "&gt;")

cheers,

Matt

Link to comment
Share on other sites

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 by lawson23
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

×
×
  • Create New...