


- #POWERSHELL WEBSITE MONITOR SCRIPT HOW TO#
- #POWERSHELL WEBSITE MONITOR SCRIPT FULL#
- #POWERSHELL WEBSITE MONITOR SCRIPT CODE#
- #POWERSHELL WEBSITE MONITOR SCRIPT SERIES#
- #POWERSHELL WEBSITE MONITOR SCRIPT FREE#
When you save the task you’ll be prompted for the credentials to run it with.
#POWERSHELL WEBSITE MONITOR SCRIPT FULL#
Enter the full path to your script between “” in the arguments. Powershell.exe goes in the program or script box. Add a folder for all the tasks This task runs every 15 minutes, note the Daily and Repeat options. Be sure the account that you choose to excute these scripts with has enough permssions to scan the servers and that WinRM is enabled on the systems you are collecting data from. Once you’ve finsihed creating the scanning task scripts, we’ll need to schedule them as repeating tasks using the Windows task scheduler. Send-MailMessage -SmtpServer -From -To -Subject "AD Status Elapsed Time" -Body "All prodcution Active Directory servers processed in $time (Hours, Minutes, Seconds) HTML pages updated." Get-ServerEvents.ps1 -list E:\Prod\ad_servers.txt -outputpath E:\ServerStatus\Prod\AD\errorevents.html Get-StoppedServices.ps1 -list E:\Prod\ad_servers.txt -outputpath E:\ServerStatus\Prod\AD\stoppedservices.html WinServ-Status.ps1 -List E:\Prod\ad_servers.txt -O E:\ServerStatus\Prod\AD\ -DiskAlert 80 -CpuAlert 95 -MemAlert 85 -Light $ErrorActionPreference = "Silentl圜ontinue" Store them all somewhere that makes sense to you, placing them in the VR directory folders will work fine. You will make one of these scripts for each group of servers you want to montior (match the folders you made above). You will need to change the paths, SMTP server and email addesses in the script below to match your environment. I like to add a timer and an alert email to my scanning task script so that I know how long each group takes to complete. Then, we’ll schedule our calling scripts as automated tasks that run every few minutes and wallah, a full system monitoring tool is born.
#POWERSHELL WEBSITE MONITOR SCRIPT SERIES#
We’re going to make another series of scripts that call our scanning tools with the lists we’ve made as input parameters and the folders we’ve made as output paths. We put them in this particular folder to make calling them with additional scripts easier. If you followed the instructions in the preceding articles, there should be three scripts in the C:\Program Files\WindowsPowerShell\Scripts folder. Once you’ve gotten your directory structure and web host all squared away, it’s time to start scanning servers and creating the files that get dumped into the folders you’ve just made. Then, under each of those, create a folder for each group of servers: AD, Exchange, SQL, that you built lists for. Make a folder for each environment that you’re going to monitor for example: development and production. Before you can add the VR directories you need to create the actual folders on whichever drive you want to store all of this data on. Once you have IIS up and running you need to add virtual directories for each group of servers that you want to monitor. If you’re going with SharePoint, when you run the installer it will guide you through the pre-requisites. In any modern version of Windows server, you add the web server role.

You can search for the instructions easily enough and including them would make this article a book. I’m not going to go through all the steps needed to get a web server up and running here. After you’re done, you’ll use SharePoint’s content viewer web part to build cohesive system report pages which I’ll get into further on in this post. I prefer to add another IIS site to the SharePoint server and then proceed with the architecture out-lined below.
#POWERSHELL WEBSITE MONITOR SCRIPT CODE#
Speaking of SharePoint, you could add some additional code to the scripts to upload the results of our scans straight into a SharePoint library, but this isn’t as easy as it sounds.
#POWERSHELL WEBSITE MONITOR SCRIPT FREE#
If not, the last free version you can get is SharePoint 2013 Foundation. To be honest, I like SharePoint, the newest version isn’t available in a free edition, but if you have an Office 365 subscription it is included. First, we need to set up a server with IIS or some other web hosting engine. To make the monitoring system work, there are still a few things we need to do. Part 4 dynamically generates the lists of servers that the first three scripts will need to run.
#POWERSHELL WEBSITE MONITOR SCRIPT HOW TO#
Part 3 describes how to use the Windows Server Status Monitor script available at GitHub and the PowerShellGallery to monitor Online status, CPU Load, Memory Load, and Disk Space. In part two, we capture all services for a list of servers that are set to automatic but not currently running, and output that list to an HTML table. In part one of this series, we wrote a script that would get errors and warnings for the last hour for a list of servers and output the results to an HTML file in a simple table.
