#187857 - 2008-05-26 06:53 AM
Get installed SSID's for a wireless NIC
|
lukeod
Getting the hang of it
Registered: 2008-01-11
Posts: 70
Loc: Australia
|
Hey all,
Does anyone know a way of getting installed SSID's of a computer? I'd have thaught that WMI or COM would have a way. I did some googling and it may also be possible to get information programatically from windows zero config service, however i wouldn't know where to start for doing that.
Thanks
Luke
|
Top
|
|
|
|
#187859 - 2008-05-26 07:59 AM
Re: Get installed SSID's for a wireless NIC
[Re: lukeod]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
I found this... http://msdn.microsoft.com/en-us/library/ms799402.aspx
...but have yet to find a working example (found some examples that didn't seem to work under vista)
|
Top
|
|
|
|
#187862 - 2008-05-26 08:56 AM
Re: Get installed SSID's for a wireless NIC
[Re: Allen]
|
lukeod
Getting the hang of it
Registered: 2008-01-11
Posts: 70
Loc: Australia
|
Thanks for the posts thus far Allen. The problem is that the wlan subsection of netsh is new to vista, and there does not appear to be a way of getting the SSID from plain old command prompt in XP
However!!! i think i'm on to somthing with WMI. Using the Query:
RedirectOutput('c:\scripts\output.txt',1)
Break On
$strComputer = "."
$objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\wmi")
$colItems = $objWMIService.ExecQuery("Select * from MSNdis_80211_ServiceSetIdentifier",,48)
?
For Each $objItem in $colItems
"********************"?
'has :' + UBound($objItem.Ndis80211SsId) + ' elements' ?
'The Array when Joined is (' + Join($objItem.Ndis80211SsId,',') + ')' ??
Next
it returns a 32 element array, containing a decimal ascii. For example it could output:
83, 111, 109, 101, 83, 83, 73, 68
Using a Ascii decimal to Ascii converter like http://www.vortex.prodigynet.co.uk/misc/ascii_conv.html, it spits out the correct SSID!!!!!
All i now need is a method of converting decimal ascii to ascii in kix =D
Cheers
Luke
|
Top
|
|
|
|
#187864 - 2008-05-26 09:07 AM
Re: Get installed SSID's for a wireless NIC
[Re: Allen]
|
lukeod
Getting the hang of it
Registered: 2008-01-11
Posts: 70
Loc: Australia
|
Hmm well that's no good
Do you know a way of converting Ascii decimal to plain old ascii? i found a script somewhere a while back written in kix to go from ascii --> ascii decimal, but searching on boards over last 15 mins aint showing much.
|
Top
|
|
|
|
#187865 - 2008-05-26 09:25 AM
Re: Get installed SSID's for a wireless NIC
[Re: lukeod]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
Do you mean like...
break on
$array=83, 111, 109, 101, 83, 83, 73, 68
for each $num in $array
$output=$output+chr($num)
next
? $output
SomeSSID
|
Top
|
|
|
|
#187866 - 2008-05-26 09:29 AM
Re: Get installed SSID's for a wireless NIC
[Re: Allen]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
By the way, I read that Vista depreciated the WMI Driver Extension Services, which is why it does not work.
|
Top
|
|
|
|
#187872 - 2008-05-27 12:44 AM
Re: Get installed SSID's for a wireless NIC
[Re: Richard H.]
|
lukeod
Getting the hang of it
Registered: 2008-01-11
Posts: 70
Loc: Australia
|
Tyvm for the code guys, it seems to work well.
I can now get the current connected SSID of the wireless nic, which is sort of what i am after. The problem is it only returns the connected SSID, not list all saved SSID's which would be ideal. It's basically run during logon to check that laptops have our ssid installed, and if not it attempts to add it using another script.
I'll have to keep playing with some of those WMI classes.
|
Top
|
|
|
|
#187878 - 2008-05-27 04:44 AM
Re: Get installed SSID's for a wireless NIC
[Re: Les]
|
lukeod
Getting the hang of it
Registered: 2008-01-11
Posts: 70
Loc: Australia
|
Well the purpose of the script is to check that the ssid has been configured for that laptop, if not, add it. Otherwise if a laptop were to have the wireless nic disabled via the switch at the front and plugged into ethernet, my script so far would not detect the SSID has been configured (if it has been) and would try and install the ssid again.
|
Top
|
|
|
|
#187883 - 2008-05-27 02:41 PM
Re: Get installed SSID's for a wireless NIC
[Re: lukeod]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Try this, it works for me. Anyone want to try with Vista? It would be useful to get some feedback.
Break ON
$sKey="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WZCSVC\Parameters\Interfaces" $iIdx1=0 $sInt=EnumKey($sKey,$iIdx1) While Not @ERROR $iIdx2=0 $sNet=EnumValue($sKey+"\"+$sInt,$iIdx2) While Not @ERROR If InStr($sNet,"Static#")=1 $sSSIDRaw=ReadValue($sKey+"\"+$sInt,$sNet) $iSSIDLen=Execute("Exit &"+SubStr($sSSIDRaw,33,2)) $sSSID="" $sSSIDRaw=SubStr($sSSIDRaw,41) While $iSSIDLen $sSSID=$sSSID+Chr(Execute("Exit &"+Left($sSSIDRaw,2))) $sSSIDRaw=SubStr($sSSIDRaw,3) $iSSIDLen=$iSSIDLen-1 Loop "Interface: "+$sInt+", Network: "+$sNet+", SSID: "+$sSSID+@CRLF EndIf $iIdx2=$iIdx2+1 $sNet=EnumValue($sKey+"\"+$sInt,$iIdx2) Loop $iIdx1=$iIdx1+1 $sInt=EnumKey($sKey,$iIdx1) Loop
|
|
Top
|
|
|
|
#187887 - 2008-05-27 04:08 PM
Re: Get installed SSID's for a wireless NIC
[Re: Richard H.]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
Well, I would except I'm in the process of wipping my Laptop with Vista on it. Boy has this been fun. Vista does something to the drive, and makes XP have a fit trying to install. The only thing I have found to work so far, is to slipstream SP3 on the Install Disk, and now (4 F'ing hours later) it appears to be installing. Holding my breath
|
Top
|
|
|
|
#187903 - 2008-05-28 12:55 AM
Re: Get installed SSID's for a wireless NIC
[Re: Allen]
|
lukeod
Getting the hang of it
Registered: 2008-01-11
Posts: 70
Loc: Australia
|
Awesome, thanks mate. That works perfectly.
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 259 anonymous users online.
|
|
|