Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2003
    Posts
    1,003
    Rep Power
    32

    Batch File that connects to my Wireless Network


    Is there a way to write a batch file that sets up a connection in the network connections for my wireless network? With the SSID, Network Authentication, Data encryption and Network Key? I just want two files that I can burn to a cd so that if I'm working on someone's laptop at home all I have to do is put this cd into the rom drive and double click the batch file to connect and then I'd have to double click the other batch file to completely remove that connection from the list. I don't broadcast my SSID so when I say remove I mean so that there's no trace of it left in the Windows system. Is that possible?
  2. #2
  3. Providing fuel for space ships
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2004
    Location
    nr Edinburgh, Scotland
    Posts
    14,382
    Rep Power
    3848
    Hmmm, good question ! To be honest, I've never seen a batch file used for this purpose and not even sure it's possible. Should be a kinda slack day today so I'll have a wee try and see what I can come up with.
    The No Ma'am commandments:

    1.) It is O.K. to call hooters 'knockers' and sometimes snack trays
    2.) It is wrong to be French
    3.) It is O.K. to put all bad people in a giant meat grinder
    4.) Lawyers, see rule 3
    5.) It is O.K. to drive a gas guzzler if it helps you get babes
    6.) Everyone should car pool but me
    7.) Bring back the word 'stewardesses'
    8.) Synchronized swimming is not a sport
    9.) Mud wrestling is a sport
  4. #3
  5. 'fie' on me, allege-dly
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2003
    Location
    in da kitchen ...
    Posts
    12,894
    Rep Power
    6444
    surely that would be down to the client utilities provided with each radio

    one possibility might be to lock the machine down by mac id, assuming your wireless supports it

    ipconfig /all
    parse for mac id
    pass mac id to a small perl script or wget to pass the username, password, and mac id to the webserver on the wireless

    perhaps a second wireless station which permits lock down in this manner

    Just a thought
    --Ax
    without exception, there is no rule ...
    Handmade Irish Jewellery
    Targeted Advertising Cookie Optout (TACO) extension for Firefox
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones


    09 F9 11 02
    9D 74 E3 5B
    D8 41 56 C5
    63 56 88 C0
    Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
    -- Jamie Zawinski
    Detavil - the devil is in the detail, allegedly, and I use the term advisedly, allegedly ... oh, no, wait I did ...
    BIT COINS ANYONE
  6. #4
  7. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2003
    Posts
    1,003
    Rep Power
    32
    Originally Posted by aitken325i
    Hmmm, good question ! To be honest, I've never seen a batch file used for this purpose and not even sure it's possible. Should be a kinda slack day today so I'll have a wee try and see what I can come up with.
    Did you ever come up with anything?
  8. #5
  9. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2003
    Posts
    1,003
    Rep Power
    32
    Originally Posted by Axweildr
    surely that would be down to the client utilities provided with each radio

    one possibility might be to lock the machine down by mac id, assuming your wireless supports it

    ipconfig /all
    parse for mac id
    pass mac id to a small perl script or wget to pass the username, password, and mac id to the webserver on the wireless

    perhaps a second wireless station which permits lock down in this manner

    Just a thought
    First question that I have is, what do you mean by "radio"?

    My Router does support mac address filtering, as a matter of fact that is something I use on my network. Are you saying that it would be possible to work into this batch file the ability to log onto the router and add a mac address to my filter?
  10. #6
  11. 'fie' on me, allege-dly
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2003
    Location
    in da kitchen ...
    Posts
    12,894
    Rep Power
    6444
    Wireless cards are radios, for domestic use, usually in the 2.4Ghz spectrum.

    Lynx or a perl script should be able to interact with the webserver on the accesspoint/router, and your batch/perl script should be able to pass the credentials and mac id to the webserver, and therby the OS of the device

    HTH
    --Ax
    without exception, there is no rule ...
    Handmade Irish Jewellery
    Targeted Advertising Cookie Optout (TACO) extension for Firefox
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones


    09 F9 11 02
    9D 74 E3 5B
    D8 41 56 C5
    63 56 88 C0
    Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
    -- Jamie Zawinski
    Detavil - the devil is in the detail, allegedly, and I use the term advisedly, allegedly ... oh, no, wait I did ...
    BIT COINS ANYONE
  12. #7
  13. Providing fuel for space ships
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2004
    Location
    nr Edinburgh, Scotland
    Posts
    14,382
    Rep Power
    3848
    Originally Posted by DKY
    Did you ever come up with anything?
    Sorry matey, not yet. Been trying though and don't think it's possible with a batch file . . . . . doesn't mean to say I've given up checking, I like a challenge.
    The No Ma'am commandments:

    1.) It is O.K. to call hooters 'knockers' and sometimes snack trays
    2.) It is wrong to be French
    3.) It is O.K. to put all bad people in a giant meat grinder
    4.) Lawyers, see rule 3
    5.) It is O.K. to drive a gas guzzler if it helps you get babes
    6.) Everyone should car pool but me
    7.) Bring back the word 'stewardesses'
    8.) Synchronized swimming is not a sport
    9.) Mud wrestling is a sport
  14. #8
  15. duffy duck
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    206
    Rep Power
    59
    You are not secure simply by hiding your SSID or using MAC Address filtering. See an article such as this one on technet.

    Incidentally normal users cannot install or uninstall devices so your batch file hypothesis would need an admin user.

    What OS are you on as the likes of XP have the WZC (wireless zero config) which is not on older OS's?
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    surfing the interwebz
    Posts
    2,410
    Rep Power
    2005
    Windows Vista will support this feature, you can upload the settings off of a flash drive.....too bad it's still in RC1 phase
  18. #10
  19. 'fie' on me, allege-dly
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2003
    Location
    in da kitchen ...
    Posts
    12,894
    Rep Power
    6444
    XP does this already, if you set Windows to run WZC (Wireless Zero Configuration), you can use a flash drive to bring new machines on to your network
    --Ax
    without exception, there is no rule ...
    Handmade Irish Jewellery
    Targeted Advertising Cookie Optout (TACO) extension for Firefox
    The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones


    09 F9 11 02
    9D 74 E3 5B
    D8 41 56 C5
    63 56 88 C0
    Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
    -- Jamie Zawinski
    Detavil - the devil is in the detail, allegedly, and I use the term advisedly, allegedly ... oh, no, wait I did ...
    BIT COINS ANYONE
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2010
    Posts
    6
    Rep Power
    0

    Wondering? N Possible Answer.


    Originally Posted by DKY
    Is there a way to write a batch file that sets up a connection in the network connections for my wireless network? With the SSID, Network Authentication, Data encryption and Network Key? I just want two files that I can burn to a cd so that if I'm working on someone's laptop at home all I have to do is put this cd into the rom drive and double click the batch file to connect and then I'd have to double click the other batch file to completely remove that connection from the list. I don't broadcast my SSID so when I say remove I mean so that there's no trace of it left in the Windows system. Is that possible?

    I was wondering if you had found an answer to this. If so i would like to know it. Also I have found out how to to do it, almost.
  22. #12
  23. Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2003
    Posts
    1,003
    Rep Power
    32
    nope, never came up with anything... If you have something, please share...
    Last edited by DKY; December 31st, 2010 at 10:02 AM.
  24. #13
  25. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  26. #14
  27. Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Location
    New Springfield, OH
    Posts
    1,250
    Rep Power
    1469
    Necro much, folks?

    Ax's suggestions is the easiest way.

    As an alternative, WZC can be scripted, but it only works if the connection already exists. So...you'd have to combine some WMI to dynamically create one subsequently remove it.

    Of course, these options only work if you're using WZC. If the client machine has it's own connection software, you're done.
    Don't like me? Click it.

    Scripting problems? Windows questions? Ask the Windows Guru!

    Stay up to date with all of my latest content. Follow me on Twitter!

    Help us help you! Post your exact error message with these easy tips!
  28. #15
  29. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2010
    Posts
    6
    Rep Power
    0
    This is what I have so Far

    @echo off
    Rem This will show your interfaces and profiles on your PC

    netsh wlan show interfaces
    netsh wlan show profiles
    pause
    Exit

    @echo off
    Rem This will save the Profile you want to use to connect the other PC, to a folder of your choosing.

    netsh wlan export profile name="YourProfile" folder=E:\netlogon

    Rem This will Rename the file if you need it to be. Just remove the rem from the beginning of the line.

    rem ren "E:\Netlogon\Wireless Network Connection-YourProfile.xml" YourProfile.xml

    pause
    Exit


    @echo off
    Rem Name this file NetConnect.bat
    Rem This will use an .XML file to create and connect Profile to a WLAN.
    Rem Note that the %~d0 in front of the \folder name, this is so whatever drive you insert this to, the letter is not needed.

    netsh wlan add profile filename="%~d0\Netlogon\Wireless Network Connection-YourProfile.xml" interface="Wireless Network Connection" user=all

    netsh wlan connect ssid=YourNetwork Name=YourProfile

    Rem Use this Choice command to give sometime to see output. Useful if you do not want to press a key to continue.

    choice /n /t 5 /d y > nul
    Exit


    @echo off
    Rem Name this file NetDisConnect.bat
    Rem This will Disconnect and Remove Profile from a WLAN.

    netsh wlan disconnect

    netsh wlan delete profile name=YourProfile interface="Wireless Network Connection"

    Rem Use this Choice command to give sometime to see output. Useful if you do not want to press a key to continue.

    choice /n /t 5 /d y > nul
    Exit

    Use this code in a NetOO.VBS file if you want to run the .BAT file without window. One for NetConnect and one for NetDisConnect.

    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run chr(34) & "NetConnect.bat" & Chr(34), 0
    Set WshShell = Nothing


    Make an AUTORUN.INF file with code.

    @echo off
    [AUTORUN]
    OPEN=WSCRIPT.EXE "NetOO.vbs"

    I was able to make autorun to work, works on disk but not on jumpdrive yet.



    Finally place the .XML, .BAT and .INF files on CD.

    Two more notes I only have VISTA PCs to work with right now and it works well. Also when NetConnect.bat creates the profile it does not put in the passphrase due to the key created is specific to each PC. At least that is the way I understand it. If you find any way around this please let me know.
    Last edited by mouthpear; January 4th, 2011 at 02:25 AM. Reason: Figured out autorun for Vista
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo