Reporting on disk usage
Keeping an eye on hard disk utilization is a key component in any monitoring solution. Depending on the environment, Exchange databases can grow quickly, and several gigabytes of logfiles can be generated in a short period of time. Obviously, you need to know if you are getting low on free disk space. In addition, you may want to track your disk utilization over time to plan upgrades and changes to your systems. This recipe will show you how you can quickly report on the disk usage on each of your servers.
How to do it...
One of the quickest ways to determine disk usage is by using WMI. Use the following command to display the capacity and free space of each local fixed disk:
Get-WmiObject Win32_LogicalDisk -Filter "DriveType='3'" | select @{n="Drive";e={$_.DeviceId}}, @{n="Size";e={[math]::Round($_.Size/1gb,2)}}, @{n="FreeSpace";e={[math]::Round($_.FreeSpace/1gb,2)}}
The output from this command will look similar to the following:
As you can see...