Skip to main content

Posts

Showing posts from March, 2014

PowerShell Scripting: Low Disk Space Notification

Update 20150812 You'll see in the below comments that I left a global variable that was not required in the original script. The below post has been updated with that variable removed. Original Post So, I came across a need to have a script that checks the free space of a hard drive, calculates the percentage and send an e-mail notification of the free space is less than 10%. I figured that this could be scripted with PowerShell and run as a scheduled task in Windows. One thing I did find out is that I needed to create a service account in Active Directory with Server Admin permissions. Once you have that account in place simply copy the script below and name it "WhatYouWant.ps1" and set your Windows task accordingly. Disclaimer: I did reach out for assistance with creating this script on StackOverflow. My original script was writing the output to a text file, and copying the contents of that text file into the e-mail notification. This was not acceptable for the long