This is a scirpt I put together but I will test the script you posted. Thanks!
On Error Resume Next
dim count
strComputer = "."
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Do until (count = "10")
count = count + 1
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM MSNdis_80211_ReceivedSignalStrength",,48)
For Each objItem in colItems
RSSI = objItem.Ndis80211ReceivedSignalStrength
Device = objItem.InstanceName
Next
Set colItems2 = objWMIService.ExecQuery( _
"SELECT * FROM MSNdis_80211_BaseServiceSetIdentifier",,48)
For Each objItem in colItems2
macbyte = 0
bssid = ""
' convert decimals to hex. pad zeros & slip in colons where needed
for each decval in objItem.Ndis80211MacAddress
if decval<17 then
bssid = bssid & "0"
end if
bssid = bssid & Hex(decval)
if macbyte < 5 then
bssid = bssid & ":"
macbyte = macbyte + 1
end if
next
Next
' wscript.echo "Ndis80211MacAddress: " & bssid
' Wscript.Echo "Ndis80211ReceivedSignalStrength: " & RSSI
Text = Text & "AP_MAC: " & bssid & " RSSI: " & RSSI & " dBm" & " Date: "
& date & " Time: " & time & " Device: " & Device
Set file = fso.OpenTextFile("wlan.txt", 8, True)
file.WriteLine(Text)
file.Close()
Text = ""
wscript.sleep 1000
Loop
wscript.echo "Script Complete!"
"Pavel A." wrote:
> "Pavel A." wrote:
> > Just for a quick test you can run a VB or js script
>
> Ok, so it will be something like:
>
> -------- begin get_ap.vbs ------
>
> Set wmi = GetObject("winmgmts:{impersonationLevel=impersonat e}!root/wmi")
>
> Set AdapterSet = wmi.ExecQuery("select * from _
> MSNdis_80211_BaseServiceSetIdentifier")
>
> For each wa in AdapterSet
> with wa
> WScript.Echo "Adapter=", .InstanceName
> sBssid = _
> hex(.Ndis80211MacAddress(0)) & ":" & hex(.Ndis80211MacAddress(1)) & ":" _
> & hex(.Ndis80211MacAddress(2)) & ":" & hex(.Ndis80211MacAddress(3)) &
> ":" _
> & hex(.Ndis80211MacAddress(4)) & ":" & hex(.Ndis80211MacAddress(5))
> WScript.Echo "Assoc AP=", sBssid
> End with
> Next
>
> If Err.Number <> 0 Then
> Wscript.Echo "Not associated. Err=", Err.Number
> End If
>
> ----------- end get_ap.vbs ---------
>
> Save this snippet as get_ap.vbs and run with cscript.
>
> Regards,
> --PA
>
|