script add wireless network XP


I need a vbscript that will add a wireless network with psk in Windows XP SP2 and/or SP3.  I've been unable to find a viable and reliable solution thus far.  Here's what I've used so far, it works sometimes but I need a more reliable solution like netsh wlan for Windows 7.

Dim objShell:Set objShell=CreateObject("Wscript.Shell")
With objShell
  .Run "control netsetup.cpl"
  wscript.sleep 100000
  .AppActivate "Wireless Network Setup Wizard"
  .SendKeys "%NSN" & SSID & "%M" & "{TAB}" & " n"
  .SendKeys "%W" & Key
  .SendKeys "%O" & Key
  .SendKeys "%NSN+{Tab}~"
End With
Set objShell=Nothing

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Arman KhodabandeIT Manager and ConsultantCommented:
This would do the job :

Work on it and make your script based upon it.
crash1624Author Commented:
I appreciate the input but I need an option that does not require installation of third party software.  I have hundreds of XP based machines to push this out to.  There has to be a suitable option built into the OS like netsh wlan for Vista/7.
Arman KhodabandeIT Manager and ConsultantCommented:
Your own script is the best method!
I don't think that you find it in XP!
Or at least I can't come up with a better solution. We'll wait for other experts to answer.
Good luck

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
crash1624Author Commented:
I agree, I don't see a better solution for XP.  Thanks for the input though.
Arman KhodabandeIT Manager and ConsultantCommented:
If you want to refine your script to work most of the time just increase the timing in case of a delay. However your timings are good and long enough to make it work!
"I've been unable to find a viable and reliable solution" >> Your script is reliable already! But I know that you looked for a real script not a physical way like this!
Using that 3rd party utility is good and reliable too.
Anyway depends on your choice . . .
Good luck
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Wireless Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.