This page looks best with JavaScript enabled

Network Device Status Monitor v2.0

With this utility I set out to generate a status report of network attached devices from a CSV file. This utility is very similar to my Windows Server Status Monitor PowerShell Utility, except the functionality is limited to ping responses and so is ideal for both Windows based and non-Windows devices. This utility is available to download from GitHub, the Microsoft TechNet Gallery and PowerShell Gallery. If you’d like to get in touch with me please use the comments, Twitter (you can tweet me and my DMs are open) or my contact form.

Please consider donating to support my work:

Thank you!

-Mike

Features and Requirements

  • The utility can output the network device name and IP address as specified in the CSV file.
  • Online/Offline status of the specified devices will be displayed.
  • The utility will display the response time of online network devices.
  • The utility can be configured to output the report as either a CSV file or a HTML file.
  • The utility can be configured to run in ‘monitor’ mode or as a one shot report.
  • The utility can be configured to email the report, or send offline alerts to Microsoft Teams

Microsoft Teams output requires an incoming webhook to be setup in your Teams instance. Here’s a walkthrough on how to do that. The script has been tested running on Windows 10, Windows Server 2016 and 2019 monitoring network devices with IPv4 addresses.

CSV File Structure

The structure of the CSV file is as follows:

1
2
3
4
IP,Name
10.30.1.1,Router
10.30.1.5,NAS
10.30.1.10,Switch 1

Generating A Password File

The password used for SMTP server authentication must be in an encrypted text file. To generate the password file, run the following command in PowerShell, on the computer that is going to run the script and logged in with the user that will be running the script. When you run the command you will be prompted for a username and password. Enter the username and password you want to use to authenticate to your SMTP server.

Please note: This is only required if you need to authenticate to the SMTP server when send the log via e-mail.

1
2
$creds = Get-Credential
$creds.Password | ConvertFrom-SecureString | Set-Content c:\scripts\ps-script-pwd.txt

After running the commands, you will have a text file containing the encrypted password. When configuring the -Pwd switch enter the path and file name of this file.

Configuration

Here’s a list of all the command line switches.

1
-List

The full path to a CSV file with a list of IP addresses and device names to monitor, separated by a comma.

1
-Teams

The full path to a txt file containing the webhook URL for Teams. If this setting is configured other output settings will be ignored.

1
-FR

Use this switch to send a full report to Teams. This setting only has an effect when used with the -Teams switch.

1
-O

The path where the HTML or CSV report should be output to. The filename will be NetDev-Status-Report.html/csv.

1
-Refresh

Enable monitoring mode. The number of seconds that she script should wait before running again. The minimum is 300 seconds (5 minutes)
and the maximum is 28800 (8 hours). If not configured the script will run once and then exit.

1
-Light

Use a light theme for the web page generated. This setting had no effect on a CSV file report.

1
-csv

Output a CSV file instead of a HTML file for the report.

1
-Subject

The subject line that the email should have. Encapulate with single or double quotes.

1
-SendTo

The email address the report should be sent to.

1
-From

The from address the report should be sent from.

1
-Smtp

The DNS or IP address of the SMTP server.

1
-User

The user account to connect to the SMTP server.

1
-Pwd

The txt file containing the encrypted password for the user account.

1
-UseSsl

Connect to the SMTP server using SSL.

Example Configuration

1
NetDev-Status.ps1 -List C:\foo\networkdevices.csv -O C:\foo -Refresh 300 -Light

Using this example config, the script will execute using the list of network devices and output a html report called NetDev-Status-Report.htm to C:\foo. The status of the network devices will refresh every 5 minutes, and the web page will have a light theme instead of a dark theme.

Change Log

2019-10-02 v2.0

  • Added Microsoft Teams as an output location, for either offline alerts, or a ‘full’ report.
  • MS teams is limited to 10 devices. Not sure if it’s a Teams/webhook limit, or my code. Will investigate.
  • Fixed bug where all devices are offline, a phantom device is added to the bottom of the offline list.
  • Cleaned up code, removing/not setting variables if they are not needed in the current mode.
  • Added console output for when the script is in ‘monitor’ mode.

2019-09-04 v1.2

  • Added custom subject line for email.

2019-02-23 v1.1

  • Updated the style of the web page with a cleaner look.
  • Added ‘online’ CSS animation when the web page is in monitor mode - this is configured by using the refresh switch. It will not display when in report mode (no refresh switch).

2018-06-13 v1.0

  • First public release.
  • Based off Windows Server Status Monitor version 1.5 code.
Share on
Support the author with