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:

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 email.

$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

The table below shows all the command line options available with descriptions and example configurations.

Command Line Switch Mandatory Description Example
-List Yes The CSV file with the network devices you wish to test. C:\foo\NetworkDevices.csv
-Teams No The full path to a txt file containing the webhook URL for Teams. C:\foo\webhook.txt
-FR No Send a full report to teams. N/A
-O No The location to output the HTML or CSV results file. C:\foo
-Refresh No The number of seconds the script should wait before refreshing the results.

The minimum refresh period is 300 seconds (5 minutes) and the maximum is 28800 (8 hours).

600
-Light No Configure the HTML results file to have a light theme. N/A
-Csv No Export a CSV file, instead of a HTML file. N/A
-Subject No The subject line that the email should have. Encapsulate with single or double quotes. ‘Server: Notification’
-SendTo No The email address to send the log file to. me@contoso.com
-From No* The email address that the log file should be sent from.

*This switch isn’t mandatory but is required if you wish to email the log file.

example@contoso.com
-Smtp No* SMTP server address to use for the email functionality.

*This switch isn’t mandatory but is required if you wish to email the log file.

mail01.contoso.com

OR

smtp.live.com

OR

smtp.office365.com

-User No* The username of the account to use for SMTP authentication.

*This switch isn’t mandatory but may be required depending on the configuration of the SMTP server.

example@contoso.com
-Pwd No* The location of the file containing the encrypted password of the account to use for SMTP authentication.

*This switch isn’t mandatory but may be required depending on your SMTP server.

c:\foo\ps-script-pwd.txt
-UseSsl No* Add this option if you wish to use SSL with the configured SMTP server.

Tip: If you wish to send email to outlook.com or office365.com you will need this.

*This switch isn’t mandatory but may be required depending on the configuration of the SMTP server.

N/A

 

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: