Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Overview of this book

Table of Contents (22 chapters)
Microsoft Exchange 2010 PowerShell Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 log files 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...

  1. One of the quickest ways to determine disk usage is using WMI. Use the following code 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 the command will look similar to the following:

  2. As you can see from the...