Networking Forums

Networking Forums > Wireless Networking > Wireless Networks > Wireless Info Script

Reply
Thread Tools Display Modes

Wireless Info Script

 
 
ddamico
Guest
Posts: n/a

 
      01-18-2008, 01:01 AM
This script is very helpful when troubleshooting wireless networks that have
several access points.

Save Start.vbs and Stop.vbs in the same directory. They will create a txt
file with the info. If anyone has anything to add to make this more uselful,
please post it here.

*****************Script #1 Name Start.vbs**********************

On Error Resume Next

Dim room, text, TCPIP, IP, MAC, NIC, Name, strComputer
Dim stopscript, colItems1, colItems2, RSSI, IPCheck, colItems3
Dim macbyte, bssid, fso, objWMIService, objWMIService2
Dim channels, frequency, raw_channel, channel

strComputer = "."
Set WSHShell = WScript.CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
Set objWMIService2 = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")



'Obtains room
room = ""
room = InputBox("Enter Room# or Floor#", "Room #")

If room = "" Then
do while room = ""
message = MsgBox("Do you want to continue?", 4, "Proceed?")
If message = 6 Then
room = InputBox("Enter Room# or Floor#", "Room #")
Else
wscript.echo "Wireless Script Complete"
wscript.quit
End if
loop
End If

Set colItems1 = objWMIService2.ExecQuery( _
"SELECT * FROM Win32_NetworkAdapterConfiguration",,48)
For Each objItem in colItems1

TCPIP = objItem.IPEnabled

If TCPIP = True Then
IPCheck = Join(objItem.IPAddress, ",")
If IPCheck <> "0.0.0.0" Then
IP = Join(objItem.IPAddress, ",")
MAC = objItem.MACAddress
NIC = objItem.Caption
Name = objItem.DNSHostName
Else
IPCheck = ""
End If

End If

Next

Set file = fso.OpenTextFile(room & ".txt", 8, True)
file.WriteLine("PC_Name: " & name)
file.WriteLine("Date: " & date)
file.WriteLine("Start Time: " & time)
file.WriteLine("PC_IP: " & IP)
file.WriteLine("PC_MAC: " & MAC)
file.WriteLine("PC_NIC: " & NIC)
file.WriteLine("Room#: " & room)
file.WriteLine()
file.Close()

stopscript = ""

Do While stopscript <> "off"

If fso.FileExists("stop.txt") Then
stopscript = "off"
Else
' stopscript = ""
End IF

'Adds information to room#.txt when starting
Set colItems2 = objWMIService.ExecQuery( _
"SELECT * FROM MSNdis_80211_ReceivedSignalStrength",,48)
For Each objItem in colItems2
RSSI = objItem.Ndis80211ReceivedSignalStrength
Next

Set colItems3 = objWMIService.ExecQuery( _
"SELECT * FROM MSNdis_80211_BaseServiceSetIdentifier",,48)
For Each objItem in colItems3
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

raw_channel = ""
channel = ""
i = ""

channels=Array(" 1 BG"," 2 BG"," 3 BG"," 4 BG"," 5 BG"," 6 BG"," 7
BG"," 8 BG"," 9 BG","10 BG","11 BG"_
,"40 A","36 A","44 A","48 A","52 A","56 A","60 A","64
A","149 A","153 A","157 A","161 A")

frequency=Array(2412000,2417000,2422000,2427000,24 32000,2437000,2442000,2447000_

,2452000,2457000,2462000,5200000,5180000,5220000,5 240000,5260000,5280000,5300000,5320000,5745000,576 5000,5785000,5805000)

set colInstances = objWMIService.ExecQuery ("SELECT * FROM
MSNdis_80211_Configuration WHERE Active = True")
for each objInstance in colInstances
raw_channel = objInstance.Ndis80211Config.DSConfig

for i=0 to ubound(frequency)

if raw_channel=frequency(i) then
channel=channels(i)
end if
next
next
' wscript.echo channel


text = text & "AP_MAC: " & bssid & " RSSI: " & RSSI & " dBm" & "
Channel: " & channel & " Time: " & time

Set file = fso.OpenTextFile(room & ".txt", 8, True)
file.WriteLine(text)
file.Close()
Text = ""

wscript.sleep 900

loop

fso.DeleteFile("stop.txt")
wscript.echo "Wireless Script Complete"

*******************Script #2 Name Stop.vbs**********************

On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
fso.createTextFile("stop.txt")
wscript.quit
 
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
Wireless Configuration Script for XP teekaybee Wireless Networks 0 11-13-2007 08:48 PM
Way to script shutting off wireless NIC when docked? Liam Curtis Wireless Networks 4 03-26-2007 06:18 PM
Copy files using filenames from text files with shell script or bash script altariamx2003@gmail.com Linux Networking 4 11-23-2006 08:27 AM
Wireless logon script Casey Windows Networking 2 10-25-2006 11:18 PM
How can I display pririority (Kernel.info or Auth.Info) in /var/log/messages? GS Linux Networking 4 07-09-2006 09:50 PM



1 2 3 4 5 6 7 8 9 10 11