Networking Forums

Networking Forums > Wireless Networking > Wireless Networks > obtain info about wireless connection

Reply
Thread Tools Display Modes

obtain info about wireless connection

 
 
myspacee
Guest
Posts: n/a

 
      08-14-2008, 08:40 AM
hello,
i've a request.

with vbs script, Is possible to obtain info about wireless connection ?

Need :
- ssid
- signal strenght
- if wep or wpa protection is activated
- channel

thank you,

m.
 
Reply With Quote
 
 
 
 
Pavel A.
Guest
Posts: n/a

 
      08-14-2008, 09:36 AM
myspacee wrote:
> hello,
> i've a request.
>
> with vbs script, Is possible to obtain info about wireless connection ?
>
> Need :
> - ssid
> - signal strenght
> - if wep or wpa protection is activated
> - channel


Here's one short example.
For more, please ask in scripting newsgroups or
microsoft.public.platformsdk.networking.

Regards,
--PA


========= begin ===============
'From: http://www.theludwigs.com/smithsandb...t/vbscript.htm
‘VBscript for 802.11 SSID and WMI
‘ it should report 802.11 access points in the vicinity.

Set nicSet = _
GetObject("winmgmts:{impersonationLevel=impersonat e}!root/wmi")._
InstancesOf("MSNdis_80211_ReceivedSignalStrength")

For Each nic In nicSet
ss = nic.Ndis80211ReceivedSignalStrength
Next

Set nicSet = _
GetObject("winmgmts:{impersonationLevel=impersonat e}!root/wmi")._
InstancesOf("MSNdis_80211_BSSIList")

For Each nic In nicSet
obset = nic.Ndis80211BSSIList
Next

Text= ""

For Each ob In obset
ssidarr = ob.Ndis80211SsId
RSSI = ob.Ndis80211Rssi
SSID = ""

For t = 0 To 31
If ssidarr(t) > 13 Then
SSID = SSID + Chr(ssidarr(t))
End If
Next

Text = Text & SSID & " " & RSSI & " dBm" & vbCrLf
Next

MsgBox "The 802.11 Basestations are :" & vbcrlf & Text & vbcrlf
'=========== end ======================
 
Reply With Quote
 
myspacee
Guest
Posts: n/a

 
      08-14-2008, 10:45 AM
little buggy class...

scripts find often return garbage as ssid name.

but Find nice one :

'-----8<------------------------------------------------
On Error Resume Next

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Set fso = CreateObject("Scripting.FileSystemObject")

Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonat e}!root/wmi")

While True

set scan = wmi.Get("MSNDis_80211_BssIdListScan")
set scanInst = scan.SpawnInstance_
scanInst.InstanceName = "D-Link AirPlus XtremeG+ DWL-G650+ Wireless
Cardbus Adapter"
scanInst.Active = True
scanInst.UnusedParameter = 0
scanInst.Put_

Set nicSet = Wmi.InstancesOf("MSNdis_80211_BSSIList")
For Each nic In nicSet
obset = nic.Ndis80211BSSIList
Next

Text= ""
For Each ob In obset
macAddr = ob.Ndis80211MacAddress
RSSI = ob.Ndis80211Rssi
macAddrStr = ""
For t = 0 To 5
macAddrStr = macAddrStr + Hex(macAddr(t))
Next
Text = Text & macAddrStr & " " & RSSI & " dBm" & vbCrLf
next

'msgbox "The 802.11 Basestations are :" & vbcrlf & Text & vbcrlf

Set file = fso.OpenTextFile("wlan.txt", ForWriting, True)
file.WriteLine(Text)
file.Close()

Set fileLog = fso.OpenTextFile("wlanlog.txt", ForAppending, True)
fileLog.WriteLine("-" & Now & "-")
fileLog.WriteLine(Text)
fileLog.Close()

WScript.Sleep 1000

Wend
'-------------------->8----------------------------------------



can anyone add ssid name in log created ?


Pavel thank you for reply, where can i found ?
microsoft.public.platformsdk.networking

thank you,

m.


"Pavel A." wrote:

> myspacee wrote:
> > hello,
> > i've a request.
> >
> > with vbs script, Is possible to obtain info about wireless connection ?
> >
> > Need :
> > - ssid
> > - signal strenght
> > - if wep or wpa protection is activated
> > - channel

>
> Here's one short example.
> For more, please ask in scripting newsgroups or
> microsoft.public.platformsdk.networking.
>
> Regards,
> --PA
>
>
> ========= begin ===============
> 'From: http://www.theludwigs.com/smithsandb...t/vbscript.htm
> ‘VBscript for 802.11 SSID and WMI
> ‘ it should report 802.11 access points in the vicinity.
>
> Set nicSet = _
> GetObject("winmgmts:{impersonationLevel=impersonat e}!root/wmi")._
> InstancesOf("MSNdis_80211_ReceivedSignalStrength")
>
> For Each nic In nicSet
> ss = nic.Ndis80211ReceivedSignalStrength
> Next
>
> Set nicSet = _
> GetObject("winmgmts:{impersonationLevel=impersonat e}!root/wmi")._
> InstancesOf("MSNdis_80211_BSSIList")
>
> For Each nic In nicSet
> obset = nic.Ndis80211BSSIList
> Next
>
> Text= ""
>
> For Each ob In obset
> ssidarr = ob.Ndis80211SsId
> RSSI = ob.Ndis80211Rssi
> SSID = ""
>
> For t = 0 To 31
> If ssidarr(t) > 13 Then
> SSID = SSID + Chr(ssidarr(t))
> End If
> Next
>
> Text = Text & SSID & " " & RSSI & " dBm" & vbCrLf
> Next
>
> MsgBox "The 802.11 Basestations are :" & vbcrlf & Text & vbcrlf
> '=========== end ======================
>

 
Reply With Quote
 
Pavel A.
Guest
Posts: n/a

 
      08-14-2008, 12:39 PM
myspacee wrote:
> little buggy class...
>
> scripts find often return garbage as ssid name.


This is because there are two structures for SSID name:
the old one (NDIS_WLAN_BSSID) has fixed size, it
is what WMI uses on WinXP.
The new struct, NDIS_WLAN_BSSID_EX, has variable size
(so you can't simply make array of these) and it breaks
the older WMI classes.
All modern wi-fi drivers return only new structs.

--PA
 
Reply With Quote
 
myspacee
Guest
Posts: n/a

 
      08-14-2008, 01:35 PM
modify script to obtain also SSID

'------------------8<-------------------------------------------------
' VBScript source code
On Error Resume Next

Set fso = CreateObject("Scripting.FileSystemObject")

Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonat e}!root/wmi")

set scan = wmi.Get("MSNDis_80211_BssIdListScan")
set scanInst = scan.SpawnInstance_
scanInst.Active = True
scanInst.UnusedParameter = 0
scanInst.Put_

Set nicSet = Wmi.InstancesOf("MSNdis_80211_BSSIList")


For Each nic In nicSet
obset = nic.Ndis80211BSSIList


Text= ""

'------------------------------------------ MAC
For Each ob In obset
macAddr = ob.Ndis80211MacAddress
RSSI = ob.Ndis80211Rssi
macAddrStr = ""
For t = 0 To 5
macAddrStr = macAddrStr + Hex(macAddr(t)) + "."
Next


'------------------------------------------ SSID
ssidarr = ob.Ndis80211SsId
SSID = ""
set objSWbemServices = GetObject("winmgmts:\\.\root\wmi")
set colInstances = objSwbemServices.ExecQuery("SELECT * FROM
MSNdis_80211_BSSIList")

for each obj in colInstances
for each rawssid in obj.Ndis80211BSSIList
ssid = ""
for i=0 to ubound(rawssid.Ndis80211SSid)
decval = rawssid.Ndis80211Ssid(i)
if (decval > 31 AND decval < 127) then
ssid = ssid & Chr(decval)
end if
next
next
next
Next


wscript.echo SSID & " " & Text & "MAC:" & macAddrStr & " RSSI:" & RSSI &
" dBm" & vbCrLf
Text = SSID & " " & Text & "MAC:" & macAddrStr & " RSSI:" & RSSI & " dBm"
& vbCrLf
next

Set file = fso.OpenTextFile("wlan.txt", 2, True)
file.WriteLine(Text)
file.Close(
---------------------->8-------------------------------------------------------


miss info about encription (wep, Wpa) and used channel...

anyone want to help ?


m.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to obtain internet connection - total novice dollface86 Wireless Internet 10 11-26-2007 03:50 AM
Wireless Network Connection Unable to obtain IP Ralf B. Lukner Wireless Networks 8 08-17-2006 08:02 PM
Porfast connection info on Windows ? Marlon Brown Windows Networking 1 01-23-2006 09:01 PM
Info please re connection ratio of NTL ted_radioham Broadband 7 08-24-2005 01:26 AM
Sky 2meg connection any more info pls !? Mr Scott Smith Broadband 4 01-14-2004 10:38 AM



1 2 3 4 5 6 7 8 9 10 11