Sign in to follow this  
Followers 0
lawson23

Wireless Help

7 posts in this topic

#1 ·  Posted (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 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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by MattyD

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by lawson23

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by MattyD

Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by lawson23

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • CartoonDragon
      By CartoonDragon
      Hi Everyone,

      I hope someone is able to help me here, i want to detect the "Charm" windows in win8 in a hope to control them, but for now i can't even detect them as a window, does anyone know how i'd be able to detect the windows? specficly the window i want to detect is in win8 when you press "Winkey + I"

      My initial idea was simple, but doesn't work (tho it might get the wrong Charm window still nothing)

      WinWait("[Class:Shell_CharmWindow]")
      msgbox(0,"yey", "yey")

      So i went and tried with the name of the window, which in my case is "Indstillinger" Tho in english i'm guessing it's "Settings"

      WinWait("Settings")
      msgbox(0,"yey","yey")

      This of course did not work either.

      Ultimately what i want to do is to setup a Windows 8 none domain computer to a WPA2 Enterprise network with user credentials with out the user having to set this up manually. This we have done easily in windows XP, Vista and Win7 by using a "Wlan.exe" (Much like netsh, but for winxp as well) to import a wireless profile, this makes all the other windows pop up and promt for the user credentials, but windows 8 does not do this.

      Update
      -------------------------------
      I've found a way to open the network window by sending a command, but still no way of detecting it.
      rundll32.exe %SystemRoot%\system32\van.dll, RunVAN