Powershell script to monitor CSV Freespace
There is no SCOM management pack to monitor the freespace on you’re CSV’s.
This can be an issue when you use Dynamically Expanding VHD’s which are common used as boot disks.
Hopefully Microsoft will create a SCOM Management pack, but until that time at least I know I won’t be suprised by VM’s pausing because my CSV ran out of space.
Therefor I used a Powershell script posted on the MSDN blog : http://blogs.msdn.com/b/clustering/archive/2010/06/19/10027366.aspx created by Simon Perriman
To use the scripts first run : “Set-ExecutionPolicy unrestricted” on the machine which will execute the script.
– The script must be run on a Cluster Node
– Threshold (When the FreeSpace % hits under this value it will be logged)
– HIGHPRIO (When the FreeSpace % hits under this value the mail will be marked as High Priority)
– [[-Logging] ] (Output to screen)
– [[-MailLog] ] (Output to mail)
– [[-Mailto] ] (Mandatory when output to mail is used)
– [[-From] ] (Mandatory when output to mail is used)
– [[-Subject] ] (Mandatory when output to mail is used)
– [[-Smtpserver] ] (Mandatory when output to mail is used)
– [[-CompleteLog] ] (Table of all CSV’s Size, Used, Free and Percentage free)
– [[-Exclusions] ] (If you would like to exclude some CSV’s seperate by comma, it’s only excluded from Threshold, on HIGHPRIO Threshold it will be included)
Get-CSVFreeSpace –Threshold 10 –HIGHPRIO 4 -Logging $true
Get-CSVFreeSpace –Threshold 10 -HIGHPRIO 4 –CompleteLog $true –Logging $true
Get-CSVFreeSpace –Threshold 10 -HIGHPRIO 4 –MailLog $true –Mailto ‘email@example.com’ –from ‘firstname.lastname@example.org’ –subject ‘CSV Freespace’ –smtpserver ‘mail.somewhere.com’ -Exclusions “CSV1″,”CSV2”
Simply extract all the files from csv.zip and CSV FreeSpace Result.zip in C:\Support and import the CSV FreeSpace Result.xml in the Task Scheduler.
Edit the csvreport.ps1 script and change the parameters to you’re needs (mailto, from, smtp etc.)
Good luck with this script.