![]() |
obtain info about wireless connection
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. |
Re: obtain info about wireless connection
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 ====================== |
Re: obtain info about wireless connection
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 ====================== > |
Re: obtain info about wireless connection
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 |
Re: obtain info about wireless connection
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. |
| All times are GMT. The time now is 08:41 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.