Jump to content

Setup Wireless profile in xp


tomatthe
 Share

Recommended Posts

Hopefully some others might find this useful. I reimage a ton of computers and need them setup with a specific profile after being imaged. After searching forever i wasn't able to find a way to have wireless profiles saved after running sysprep. I set this in the startup folder and have a batch file delete after it runs. The code is not the best i'm sure, but its my first attempt at an autoit script, and its been very useful to me.

;Check OS version, script only works with Win XP SP2

dim $OS = @OSSERVICEPACK

if $OS = "SERVICE PACK 2" then

else

MsgBox("1","Error","Script only works with Win_XP SP2",10)

exit

endif

blockinput(1)

;Open Wireless Network Connection Wizard

run ("rundll32 shell32.dll,Control_RunDLL netsetup.cpl,@@,WNSW")

;Wait on Wizard to open

winwait ("Wireless Network Setup Wizard", "Welcome to the Wireless Network Setup Wizard")

;Click Next on Initial Screen

controlclick ("Wireless Network Setup Wizard","Welcome to the Wireless Network Setup Wizard","&Next >")

;Var used to check if the screen to add to any already existing profile shows up

dim $profileCheck = WinGetText("Wireless Network Setup Wizard")

;Checks to see if window to add to existing shows, selects add new if it does.

if StringInStr ($profileCheck, "&Set up a new wireless network") = 0 then

else

sleep(100)

controlclick ("Wireless Network Setup Wizard", "&Set up a new wireless network", "&Set up a new wireless network")

sleep(100)

controlclick ("Wireless Network Setup Wizard","&Set up a new wireless network","&Next >")

sleep(100)

endif

controlclick ("Wireless Network Setup Wizard","Give your network a name, using up to 32 characters.","&Manually assign a network key")

controlsend("Wireless Network Setup Wizard","Give your network a name, using up to 32 characters.","Edit1","YOUR SSID HERE")

sleep(100)

controlclick("Wireless Network Setup Wizard","Give your network a name, using up to 32 characters.","&Next >")

sleep(100)

controlsend("Wireless Network Setup Wizard","- Exactly 5 or 13 characters","Edit1","YOURWEPKEYHERE")

send ("{tab}")

sleep(100)

controlsend("Wireless Network Setup Wizard","- Exactly 5 or 13 characters","Edit2","YOURWEPKEYHERE")

sleep(100)

controlclick ("Wireless Network Setup Wizard","- Exactly 10 or 26 characters using 0-9 and A-F","&Next >")

sleep(100)

controlclick ("Wireless Network Setup Wizard","This wizard provides two methods for creating a wireless network. Using a flash drive is easier and more secure.","&Set up a network manually")

controlclick ("Wireless Network Setup Wizard","This wizard provides two methods for creating a wireless network. Using a flash drive is easier and more secure.","&Next >")

winwait("Wireless Network Setup Wizard","To close this wizard")

controlclick ("Wireless Network Setup Wizard","To close this wizard, click Finish.","Finish")

blockinput(0)

exit

Link to comment
Share on other sites

  • 2 months later...

Hopefully some others might find this useful.

Had to register here to say this will be extremly useful to me. I havent been able to test it yet but if it works consistently it will be fantastic. I have been searching for a way to script this. My own attempts have failed so far.

My previous attempt used the following:

Run('"' & @WindowsDir & '\System32\rundll32.exe" shell32,Control_RunDLL ncpa.cpl')
WinWaitActive("Network Connections")
Send("{LEFT}")
Send("{ALT}")
Send("{DOWN 10}")
Send("{ENTER}")
WinWaitActive("Wireless Network Connection Properties")
Send("{TAB 8}")
Send("{RIGHT}")
ControlClick("Wireless Network Connection Properties","&Add...",7033)
WinWaitActive("Wireless network properties")
Send("SSID")
ControlClick("Wireless network properties","T&he key is provided for me automatically",6021)
Send("{TAB 8}")
Send("WEPKEY")
Send("{TAB}")
Send("WEPKEY")
ControlClick("Wireless network properties","OK",1)
WinWaitActive("Wireless Network Connection Properties")
ControlClick("Wireless Network Connection Properties","OK",1)
WinWaitActive("Network Connections")
Send("{ALT}")
Send("{DOWN}")
Send("c")

This worked sometimes but sometimes the wireless network connection icon would move to the right of the LAN icon.

Hopefully I have more luck with the code from tomatthe B)

Link to comment
Share on other sites

  • 1 month later...
  • 6 years later...

Hi, this script would help me a lot. I'm very new into AutoIt and can't get this script working for WPA. Thanks.

You might find topic more useful rather than digging up a topic that's nearly 7 years old. It might have the answers you're looking for.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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

  • Recently Browsing   0 members

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