Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

ChromeFoundry

(3,270 posts)
5. I found a better way to do this...
Wed Mar 28, 2012, 10:50 PM
Mar 2012

I wrote a quick PowerShell script that will extract a few key pieces of data every 30 seconds. you can pipe it out to a file. PowerShell also has the ability to format it in CSV.

Here is what I came up with:
[div class='excerpt']$objInterface = "" | Select-Object Timestamp,Description,SSID,BSSID,Signal,Speed

while(1)
{
foreach ($strLine in (netsh wlan show interfaces))
{
if ($strLine -match "^\s+Description&quot
{
$objInterface.Description = $strLine -Replace "^\s+Description\s+:\s+",""
}
elseif ($strLine -match "^\s+SSID&quot
{
$objInterface.SSID = $strLine -Replace "^\s+SSID\s+:\s+",""
}
elseif ($strLine -match "^\s+BSSID&quot
{
$objInterface.BSSID = $strLine -Replace "^\s+BSSID\s+:\s+",""
}
elseif ($strLine -match "^\s+Signal&quot
{
$objInterface.Signal = $strLine -Replace "^\s+Signal\s+:\s+",""
}
}
$objInterface.Timestamp = Get-Date -Format 'yyyy-mm-dd hh:mm:ss'
$objInterface.Speed = (Get-wmiobject win32_NetworkAdapter | where {$_.Name.Contains($objInterface.Description)}).Speed
$objInterface | format-table
Start-Sleep -Seconds 30
}


Here is the output:
[div class='excerpt']Timestamp Description SSID BSSID Signal Speed
--------- ----------- ---- ----- ------ -----
2012-35-28 11:35:53 Intel(R) WiFi Link 5150 linksys 00:55:55:55:55:e8 83% 270000000

Timestamp Description SSID BSSID Signal Speed
--------- ----------- ---- ----- ------ -----
2012-36-28 11:36:25 Intel(R) WiFi Link 5150 linksys 00:55:55:55:5:e8 83% 243000000

Recommendations

0 members have recommended this reply (displayed in chronological order):

You can track your Bandwidth ChromeFoundry Feb 2012 #1
Thanks.... Old and In the Way Feb 2012 #2
For a CSV output... ChromeFoundry Feb 2012 #3
Great! Old and In the Way Feb 2012 #4
I found a better way to do this... ChromeFoundry Mar 2012 #5
This message was self-deleted by its author mick.bobin May 2015 #6
Latest Discussions»Culture Forums»Open Source and Free Software»Looking for a freeware ut...»Reply #5