Featured image of post Monitoring with PowerShell: Monitoring WLAN reports

Monitoring with PowerShell: Monitoring WLAN reports

This is a bit of a short one, but I’m trying to get back to two blogs a week slowly, today we’re talking about a pretty cool feature that Microsoft has made for Windows, but doesn’t get the attention it deserves. When you’re troubleshooting WLAN issues there’s a lot of locations to investigate – If users are reporting dropped networks you’ll have to check the event logs, if users are reporting authentication issues you’ll have to check the network settings.

This all gets really confusing because there’s just so many logs and so many options. Microsoft simplified this by creating the WLAN network reporting functionality. You can generate this report by executing the following command:

This generates a report in “C:\ProgramData\Microsoft\Windows\WlanReport\wlan-report-latest.html” which gives you a pretty cool overview of all events that happened on the wireless network. The only downside is that this report isn’t automatically generated so with intermittent issues it’s a bit harder to troubleshoot. For those cases, I’ve created the following monitoring script.

The Script

The script tries to generate a report each time it runs. If it can’t write the script and it won’t find a file that is newer than 4 hours, it’ll generate an alert that the reports aren’t there. You’ll still have to manually check the report unfortunately, as it’s not a parsable report due to the HTML magic in there.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
try {
    $WLANReport = netsh wlan show wlanreport
    $WriteTime = Get-Item "$($ENV:Systemdrive)\ProgramData\Microsoft\Windows\WlanReport\wlan-report-latest.html" | Where-Object { $_.lastWriteTime -gt (get-date).AddHours(-4) }
    if(!$WriteTime){ throw "No report found in last 4 hours." }
    write-host"Healthy - Latest report can be found at $($ENV:Systemdrive)\ProgramData\Microsoft\Windows\WlanReport\wlan-report-latest.html"
}
catch {
    write-host "Could not find latest report: $($_.Exception.Message)"
    exit 1
}

That’s all for today. As always, Happy PowerShelling 🙂

All blogs are posted under AGPL3.0 unless stated otherwise
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy