MattG

Matt Griffin graduated in May 2012 with a Bachelor of Science in Computer Information Technology from the Purdue School of Engineering and Technology. Currently, he is the Systems Architect at Gaylor Electric. He owns his own IT Consulting and Managed Services firm, The IT Fellas. Matt is passionate about volunteering. He serves on the Purdue School of Engineering and Technology Alumni Association Board of Directors at IUPUI since 2014. In January of 2019, Matt joined the Board of Directors for a non-profit organization named the Muscular Dystrophy Family Foundation (MDFF). The MDFF focuses on increasing the quality of life and independence of people with Muscular Dystrophy and their family through advocacy, education, and financial resources. Outside of work and volunteering, Matt enjoys participating in Adaptive Sports. Currently, he is playing for the Wheelchair Lacrosse team Indy RIP based in Indianapolis, IN.

GriffinMonitor Module v1.5 – Additional Functionality

This evening I’ve decided to add additional functionality to the GriffinMonitor Module. I noticed that I am filling up my storage on my lab server fairly quickly. With that in mind I knew I needed to know once I am about to max it out. I’ve decided to write a fairly simple alert for remaining disk space per volume. Before we dive into how to use the cmdlet and the code itself please reference the previous blog post on Monitoring Storage Pool Health – GriffinMonitor Module.

Using Alert-GMLowDiskSpace:

This cmdlet is very similar to the Alert-GMUnhealthyStoragePool as it has 3 mandatory parameters. There is a 4th parameter that is optional so you can specify the threshold at which it alerts. As I mentioned in the previous blog post at some point I intend to add additional functionality for TLS or SSL secured SMTP servers along with the ability to pass authentication. That functionality is still not there, but it is still on my to-do list.

Example:

Alert-GMLowDiskSpace -SMTPServer smtp.example.com -ToAddress Joe@example.com -FromAddress alert@example.com

-OR-

Alert-GMLowDiskSpace -SMTPServer smtp.example.com -ToAddress Joe@example.com -FromAddress alert@example.com -PctThreshold 15

 The Module Code:

#Requires -Version 3 
#Requires -Module Storage

<#
 # Module Name: GriffinMonitor.psm1
 # Created: 05/22/2014
 # Version: 1.5
 # Author: Matt Griffin (MattBlogsIT.com)
 # Purpose: This Module is a set of custom cmdlet's that are used to alert of potential health concerns in your Windows Environment
 # Legal: This module was built by Matt Griffin for use in his home lab environment. This module comes with no warranty or guarantee. 
 #        This module is provided to be used at your own risk and will not have any support backing it up.
 # History: Matt Griffin 06/18/2014
            Corrected some typo's, added new cmdlet called Alert-GMLowDiskSpace

            Matt Griffin 05/22/2014
 #          Initial creation of Module with first cmdlet Alert-GMUnhealthyStoragePool
 #>

function Alert-GMUnhealthyStoragePool
{
    <#
    .Synopsis
       This cmdlet will check all of your local systems storage pools and send you can alert when one of them enters a state other than healthy.
    .DESCRIPTION
       This cmdlet will check all of your local systems storage pools and send you can alert when one of them enters a state other than healthy. The alert will be sent through email.
    .PARAMETER SMTPServer
       This parameter will be used to specify a standard SMTP Server that doesn't require SSL or TLS.
    .PARAMETER ToAddress
       This parameter will be used to specify the email address to which the alert messages will be sent.
    .PARAMETER FromAddress
       This parameter will be used to specify the email address from which the alert messages will be sent.
    .EXAMPLE
       Alert-GMUnhealthyStoragePool -SMTPServer smtp.example.com -ToAddress Joe@example.com -FromAddress alert@example.com
    #>
    [CmdletBinding()]
    [OutputType([int])]
    Param(
        # SMTPServer This parameter specifies the SMTP Server to utilize when alerting of unhealthy Storage Pool
        [Parameter(Mandatory=$true,Position=0)]
        $SMTPServer,
        
        # ToAddress This is the email address that the alert message will be sent to
        [Parameter(Mandatory=$true,Position=1)]
        $ToAddress,

        # FromAddress This is the email address that the alert message will be sent to
        [Parameter(Mandatory=$true,Position=2)]
        $FromAddress
    )
    #Import Required PowerShell Module
    Import-Module -Name Storage

    $storagePools = Get-StoragePool

    foreach($pool in $storagePools){
        if($pool.HealthStatus -ne "Healthy" -and $pool.IsPrimordial -ne "True"){

            $physicalDisks = $pool | Get-PhysicalDisk | 
            Select FriendlyName, Manufacturer, Model, SerialNumber, OperationalStatus, HealthStatus, Usage, Size | ConvertTo-Html

            #Create hash table to splat for Send-MailMessage
            $mailMessageParams = @{'SmtpServer'=$SMTPServer;
                                   'From'=$FromAddress;
                                   'To'=$ToAddress;
                                   'Subject'="The Storage Pool $($pool.FriendlyName) is currently $($pool.HealthStatus) on $env:computername";
                                   'Body'=($physicalDisks | Out-String);
                                   'BodyAsHtml'=$true}

            Send-MailMessage @mailMessageParams
        }
    }
}

function Alert-GMLowDiskSpace
{
    <#
    .Synopsis
       This cmdlet will check all of your local systems volumes and send you can alert when one of them reaches a specified threshold.
    .DESCRIPTION
       This cmdlet will check all of your local systems volumes and send you can alert when one of them reaches a specified threshold. The default threshold is 10.
    .PARAMETER SMTPServer
       This parameter will be used to specify a standard SMTP Server that doesn't require SSL or TLS.
    .PARAMETER ToAddress
       This parameter will be used to specify the email address to which the alert messages will be sent.
    .PARAMETER FromAddress
       This parameter will be used to specify the email address from which the alert messages will be sent.
    .PARAMETER PctThreshold
       This parameter is the threshold the remaining space must reach before sending an email, by default it is 10.
    .EXAMPLE
       Alert-GMLowDiskSpace -SMTPServer smtp.example.com -ToAddress Joe@example.com -FromAddress alert@example.com
    .EXAMPLE
       Alert-GMLowDiskSpace -SMTPServer smtp.example.com -ToAddress Joe@example.com -FromAddress alert@example.com -PctThreshold 15
    #>
    [CmdletBinding()]
    [OutputType([int])]
    Param(
        # SMTPServer This parameter specifies the SMTP Server to utilize when alerting of unhealthy Storage Pool
        [Parameter(Mandatory=$true,Position=0)]
        $SMTPServer,
        
        # ToAddress This is the email address that the alert message will be sent to
        [Parameter(Mandatory=$true,Position=1)]
        $ToAddress,

        # FromAddress This is the email address that the alert message will be sent to
        [Parameter(Mandatory=$true,Position=2)]
        $FromAddress,

        # PctThreshold is the threshold the remaining space must reach before sending an email
        [Parameter(Mandatory=$false,Position=3)]
        $PctThreshold=10
    )
    #Import Required PowerShell Module
    Import-Module -Name Storage

    $volumes = Get-Volume

    foreach($volume in $volumes){
        if($volume.DriveType -eq "Fixed"){
            #Calculating the amount of space remaining as a percentage
            $pctRemaining = "{0:N2}" -f ($volume.SizeRemaining/$volume.Size*100)

            if($pctRemaining -le $pctThreshold){
                $output = $volume | 
                Select DriveLetter, FileSystemLabel, FileSystem, HealthStatus, @{N="PctRemaining";e={$pctRemaining+"%"}} | 
                ConvertTo-Html

                #Create hash table to splat for Send-MailMessage
                $mailMessageParams = @{'SmtpServer'=$SMTPServer;
                                       'From'=$FromAddress;
                                       'To'=$ToAddress;
                                       'Subject'="The Volume $($volume.DriveLetter): has $pctRemaining% remaining on $env:computername";
                                       'Body'=($output | Out-String);
                                       'BodyAsHtml'=$true}

                Send-MailMessage @mailMessageParams
            }
        }
    }
}

 Update Instructions:

  1. Open C:\Users\<username>\Documents\WindowsPowerShell\Modules\GriffinMonitor with the PowerShell ISE or your favorite text editing document
  2. Replace the code with the above script
  3. Create a Scheduled Job for the new PowerShell cmdlet
    1. #The below PowerShell commands will schedule the cmdlet to run every 30 minutes using the SMTPServer xxx.xxx.xxx.xxx, emailing to joe@example.com and coming from noreply@example.com - Make sure you update the parameter values.
      $trig = New-JobTrigger -Once -At "5/22/2014 0am" -RepetitionInterval (New-TimeSpan -Minute 30) -RepetitionDuration ([TimeSpan]::MaxValue)
      Register-ScheduledJob -Name CheckStoragePoolHealth -ScriptBlock { Alert-GMLowDiskSpace -SMTPServer xxx.xxx.xxx.xxx -ToAddress joe@example.com -FromAddress noreply@example.com} -Trigger $trig

Installation Instructions:

  1. Navigate to C:\Users\<username>\Documents\WindowsPowerShell\Modules\GriffinMonitor
    1. (Note: If the directory doesn’t exists you must create it.)
  2. Save the above code in a file named GriffinMonitor.psm1 under the above directory
  3. Create a Scheduled Job using PowerShell
    1. #The below PowerShell commands will schedule the cmdlet to run every 30 minutes using the SMTPServer xxx.xxx.xxx.xxx, emailing to joe@example.com and coming from noreply@example.com - Make sure you update the parameter values.
      $trig = New-JobTrigger -Once -At "5/22/2014 0am" -RepetitionInterval (New-TimeSpan -Minute 30) -RepetitionDuration ([TimeSpan]::MaxValue)
      Register-ScheduledJob -Name CheckStoragePoolHealth -ScriptBlock { Alert-GMLowDiskSpace -SMTPServer xxx.xxx.xxx.xxx -ToAddress joe@example.com -FromAddress noreply@example.com} -Trigger $trig

Once it is scheduled, keep an active eye on your inbox for when your Storage Pool goes unhealthy!

Miscellaneous Notes:

  • This module was built and tested using PowerShell v4 on Server 2012 R2 running a single Storage Pool.
  • This module “should” work with Server 2012 running PowerShell v3 with one or many Storage Pools
  • This module comes with no guarantee or support, this is a run at your own risk and I take no responsibility for any repercussions that may occur by running this.
    • With that being said I’ll try my best to assist anyone who may have questions if you post in the comments of this thread.

The ever Evolving Career of IT – Reflecting on the last Decade

I’ve been working professionally in IT for 6 years, and I have been working with computers for over 10. I quickly realized that if I continued down this path for my life, I would be in a constant learning curve. This was something that interested me as I always enjoy learning new things and playing with new technologies.

My initial interest was in web development up until I reached college. I took two part time jobs, one doing web development, another doing help desk support. Initially I was very excited to do the development job, I started digging in, expanding my knowledge and trying to advance all of my skills. I quickly realized that I enjoyed the help desk support much more. My favorite part of help desk support was that I was able to help people every day. I would leave a faculty members office and they would be very satisfied that they received assistance. I had no previous customer service experience, but was exhilarated with the interactions I had on a daily basis.

As the years progressed I continued down the IT Pro path, and started moving into server administration prior to graduating college. I had loved the customer service, but I felt there was a greater good I could provide by managing the back end systems. I wouldn’t get as much recognition as I had previously, but I would have many more challenges and still be helping.

I started at Apparatus 1 year prior to graduating college and I have just wrapped up my 3rd year here recently. In those 3 years I have gone from part time employee, to full time entry level management. In the last 6 months I’ve done a lot of reflecting on where I want my career to go. I’ve been saying that I had no idea I would be where I am last year, lets see where this year will take me.

I currently am in an internal battle with myself on if I’d like to pursue my IT career further or if I’d like to jump over to management; while trying to keep my IT skills as fresh as possible. I still have yet to make a decision, and I am considering my options on a daily basis. I do love the management by getting to help co-workers develop their skills and become greater at their job. I like to help them pursue their dreams while working in IT and I love getting hands on dirty with the work.

As of today I am Matt Griffin, Technical Team Lead at Apparatus. Tomorrow… who knows what I will be.

Building The New Battle Station

For the last 5 years, I’ve owned the same desktop computer that I do most of my work from at home. The computer was solid, a Dell XPS 630i. It still was performing like a champ with an occasional blue screen, I believed caused by the SLI video cards. I don’t have much time for video games so I figured there was no point in replacing it for the longest time.

WP_20140526_002
Before monitor replacement

After two random blue screens in the same evening I decided it was time to bite the bullet and replace the system. I had no interest in spending hours troubleshooting the issues when I knew I wanted a new computer anyway. Now was the time to decide if I was going to purchase a new system or build my own. I did quite a bit of research and I wanted to buy a fairly solid gaming rig that will last me at least another 5 years. Looking at the options out there and comparing the cost associated I decided to build my own machine.

Exploring Windows Management Framework 5.0 May 2014 Preview

The Windows Management Framework 5.0 Preview was released in early April, and an update to it was posted during Microsoft TechEd in May. Some major things are changing with PowerShell; the main one being that new versions of PowerShell are not going to be tied to major OS releases. PowerShell will be released as it is ready, and then added into the OS for the latest version.

Two of the major changes with PowerShell v5.0 include two new modules; the OneGet Module and the PowerShellGet Module. In this blog post we are going to explore some of the basics for these modules. If you would like to play with the Windows Management Framework 5.0, if can be downloaded from the Microsoft Download Center. Please note that this is preview code and should not be used in production. You are using this at your own risk and I strongly encourage testing it on the VM until the final code is released.

Please note that this is just a very quick overview of the modules and we will dive into more depth on them in upcoming blog posts.

psv5

Monitoring Storage Pool Health – GriffinMonitor Module

There have been times in the past (more than I like to remember) where I’ve had a hard drive fail, a raid 5 fail, and eventually I am sure I’ll have a Storage Pool fail at some point with my lab environment. The best way to avoid this is by introducing active and heavy monitoring. In my work world I am very good and forward thinking when it comes to this; however no matter how many times it happens in my home environment I still fail at maintaining the system.

When Server 2012 was released with the introduction of Storage Pools I had just lost my RAID 5, I decided it was the right time to implement Storage Pools as my primary storage at home. It uses parity which is basically a software raid, and I was able to use cheap consumer drives along with USB drives (YAY! more space since I was out of it inside of the server.)

I’ve been running Storage Pools for over a year, knowing one major issue with my setup. I have absolutely no monitoring in place, and if I were to have a drive fail it could be weeks… maybe months before I realize an issue exists. I recently went through updating my home lab from Server 2012 to 2012 R2 and decided I needed to stop fooling around with my data and get some monitoring in place.

Well the first issue came along… how am I going to monitor my Storage Pool? Sadly there is no easy alerting of an unhealthy Storage Pool built in… I’m sure there are third party tools, but do I really want to go through the hassle of setting that up for just my Storage Pool? The good news is that PowerShell has some fantastic cmdlet’s available for working with storage.

When I started building my monitoring solution I initially thought… a simple script on a scheduled task will get the job done. As I built it out, I decided that I needed to go further than I have in the past, I needed to build a cmdlet, then once I finished that I thought why stop there? Why not built my first module? This module currently only contains a single PowerShell cmdlet, but as time goes on I hope to build out many more that I can continue to use in my environment at home. Below is the entire source of the psm1 file that is stored in my Modules directory along with installation instructions and directions on how to use the cmdlet.

Using Alert-GMUnhealthyStoragePool:

This is a fairly straightforward cmdlet, only 3 mandatory parameters and it works. There are quite a few restrictions surrounding the SMTP Server including it cannot use TLS or SSL (Currently) and it doesn’t accept Authentication. These will be added in the future but for the first iteration of it I was going for quick and dirty for a lab environment.

Example:

Alert-GMUnhealthyStoragePool -SMTPServer smtp.example.com -ToAddress Joe@example.com -FromAddress alert@example.com

 The Module Code:

#Requires -Version 3 
#Requires -Module Storage
<#
 # Module Name: GriffinMonitor.psm1
 # Version: 1.0
 # Created: 05/22/2014
 # Author: Matt Griffin (MattBlogsIT.com)
 # Purpose: This Module is a set of custom cmdlet's that are used to alert of potential health concerns in your Windows Environment
 # Legal: This module was built by Matt Griffin for use in his home lab environment. This module comes with no warranty or guarantee. 
 #        This module is provided to be used at your own risk and will not have any support backing it up.
 # History: Matt Griffin 05/22/2014
 #          Initial creation of Module with first cmdlet Alert-GMUnhealthyStoragePool
 #>
function Alert-GMUnhealthyStoragePool
{
    <#
    .Synopsis
       This function will check all of your local systems storage pools and send you can alert when one of them enters a state other than healthy.
    .DESCRIPTION
       This function will check all of your local systems storage pools and send you can alert when one of them enters a state other than healthy. The alert will be sent through email.
    .PARAMETER SMTPServer
       This parameter will be used to specify a standard SMTP Server that doesn't require SSL or TLS.
    .PARAMETER ToAddress
       This parameter will be used to specify the email address to which the alert messages will be sent.
    .PARAMETER FromAddress
       This parameter will be used to specify the email address from which the alert messages will be sent.
    .EXAMPLE
       Alert-GMUnhealthyStoragePool -SMTPServer smtp.example.com -ToAddress Joe@example.com -FromAddress alert@example.com
    #>
    [CmdletBinding()]
    [OutputType([int])]
    Param(
        # SMTPServer This parameter specifies the SMTP Server to utilize when alerting of unhealthy Storage Pool
        [Parameter(Mandatory=$true,Position=0)]
        $SMTPServer,
        
        # ToAddress This is the email address that the alert message will be sent to
        [Parameter(Mandatory=$true,Position=1)]
        $ToAddress,

        # FromAddress This is the email address that the alert message will be sent to
        [Parameter(Mandatory=$true,Position=2)]
        $FromAddress
    )
    #Import Required PowerShell Module
    Import-Module -Name Storage

    $storagePools = Get-StoragePool

    foreach($pool in $storagePools){
        if($pool.HealthStatus -ne "Healthy" -and $pool.IsPrimordial -ne "True"){

            $physicalDisks = $pool | Get-PhysicalDisk | 
            Select FriendlyName, Manufacturer, Model, SerialNumber, OperationalStatus, HealthStatus, Usage, Size | ConvertTo-Html

            #Create hash table to splat for Send-MailMessage
            $mailMessageParams = @{'SmtpServer'=$SMTPServer;
                                   'From'=$FromAddress;
                                   'To'=$ToAddress;
                                   'Subject'="The Storage Pool $($pool.FriendlyName) is currently $($pool.HealthStatus) on $env:computername";
                                   'Body'=($physicalDisks | Out-String);
                                   'BodyAsHtml'=$true}

            Send-MailMessage @mailMessageParams
        }
    }
}

Installation Instructions:

  1. Navigate to C:\Users\<username>\Documents\WindowsPowerShell\Modules\GriffinMonitor
    1. (Note: If the directory doesn’t exists you must create it.)
  2. Save the above code in a file named GriffinMonitor.psm1 under the above directory
  3. Create a Scheduled Job using PowerShell
    1. #The below PowerShell commands will schedule the cmdlet to run every 30 minutes using the SMTPServer xxx.xxx.xxx.xxx, emailing to joe@example.com and coming from noreply@example.com - Make sure you update the parameter values.
      $trig = New-JobTrigger -Once -At "5/22/2014 0am" -RepetitionInterval (New-TimeSpan -Minute 30) -RepetitionDuration ([TimeSpan]::MaxValue)
      Register-ScheduledJob -Name CheckStoragePoolHealth -ScriptBlock { Alert-GMUnhealthyStoragePool -SMTPServer xxx.xxx.xxx.xxx -ToAddress joe@example.com -FromAddress noreply@example.com} -Trigger $trig

Once it is scheduled, keep an active eye on your inbox for when your Storage Pool goes unhealthy!

Miscellaneous Notes:

  • This module was built and tested using PowerShell v4 on Server 2012 R2 running a single Storage Pool.
  • This module “should” work with Server 2012 running PowerShell v3 with one or many Storage Pools
  • This module comes with no guarantee or support, this is a run at your own risk and I take no responsibility for any repercussions that may occur by running this.
    • With that being said I’ll try my best to assist anyone who may have questions if you post in the comments of this thread.