Yet Another MOM 2005 Disk Space Script

A client wanted to check on disk space based on whether it was a local disk, in which case 15%, or a SAN attached disk, in which case they wanted warnings at 10GB. This made sense as the large disks attached to the SAN could have 100s of GBs free and still alert based on %. Unfortunately WMI can only see what is presented to the OS. Windows doesn’t “know” that a particular volume is on a SAN or a local disk. As far as it is concerned, the SAN volume IS a local disk, therefore WMI just sees it as another instance of Win32_LogicalDisk.

Not being a scripting expert I looked around and found a number of scripts done by others but none were exactly what I wanted. I looked at the modified storage state script by Gerald Mims –!4EDF3C508D92E609!166.entry and the updated version by Scott Moss – I like the idea of the file that prevents the disk from being monitored (so added that) but did not fancy putting a text file on hundreds of servers for custom thresholds. With my lack of script skills I felt it was too complicated to change to what I wanted. I also looked at the one from Brian Wren which was nice and simple – In the end I went with the one from Geeky Girl –!759071229966AF5A!585.entry as it fitted best what I was trying to do and worked “as is” initially which always makes it easier. But shamelessly stole good ideas from the others.

The new script is designed to look at the size of the disk and dependant on size will either use % free space for small disks and GB free space for large disks. The client wanted a threshold of 15% for local disks and 10 GB for SAN disks. 10 GB is 15% if the disk size is 66.67 GB. Therefore I used a figure of 66 GB to be the dividing line to determine whether the disk was small or large but it is a parameter so you can chose your own cut off point.

Rather than a simple threshold a series of worsening thresholds was created as follows:-

Alert Level

Small Disk

Large Disk



10 GB



5 GB

Critical Error


1 GB

 I turned the hard coded figures into parameters and created the two logic chains depending on the size of disk parameter. I also borrowed the idea from Brian about using >0 to test (I was getting script errors from cluster servers without it) and heavily stole the description piece from the original storage state script which I then turned into sub routine to keep the main logic easier to read. The downside is that this is not a state based script but on the other hand it is easy to customise with the parameters, exclude drives with a file called NoDiskAlerts.MOM in the root of the drive.

I have tried to document the script as much as possible. Create a new script and copy this one in and create a timed rule to run the script and add the 7 parameters. Then create event rules for each level. All are described in the script.

Note that this ends in doc as that was the only tyoe of file I could upload. It is a text file.
Also thanks to Stuart for pointing out the INT() function.




  1. Hi

    Wow, awesome modifications to my script. Thank you. Will link back to this post from my blog, and I may just steal your mods 🙂


  1. Modifications to the custom disk space monitor script « sensory overload
%d bloggers like this: