script add wireless network XP

Posted on 2011-10-04
Last Modified: 2013-11-12

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

Question by:crash1624
    LVL 10

    Expert Comment

    by:Arman Khodabande
    This would do the job :

    Work on it and make your script based upon it.

    Author Comment

    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.
    LVL 10

    Accepted Solution

    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

    Author Comment

    I agree, I don't see a better solution for XP.  Thanks for the input though.
    LVL 10

    Expert Comment

    by:Arman Khodabande
    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

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Today sees the launch of a new case study, focusing on BYOD technologies we have been working with for some time now.  But with the advent of 802.11ac wireless technologies and the story behind our landmark developments, we would like to share this …
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
    Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now