Create Exchange 2010 Server Reports with PowerShell

Posted on May 8, 2013 by Jeff Hicks in Exchange Server with 0 Comments

My recent articles have focused on reporting on mailbox usage in Microsoft Exchange 2010 with PowerShell (see: Create Exchange 2010 Mailbox Size Reports with PowerShell, as well as creating individual inbox reports and multiple inbox reports). But you might also want to prepare reports on the Exchange 2010 server itself. I believe there are several items that merit your attention. Some of these areas will require the Exchange Management Console. Others can be done from any administrator desktop with RPC and/or WMI access. But they all can be accomplished using PowerShell.

Service Reports

On one hand, getting the status of Exchange-related services is very easy and doesn’t require anything other than a PowerShell prompt, admin credentials, and RPC connectivity to the Exchange server.

I defined a variable for my Exchange server to save some typing. The result of this command can be seen below.

exchange 2010 server

At a glance it is easy to see which services stopped. The downside is that we can’t tell which services are disabled, which is why they aren’t running. But this is fast and it may be all you need. Otherwise, we’ll turn to WMI.

Now, as you can see in Figure 2, I can identify potential problem services, i.e. those that are configured to auto start but are not running.
exchange 2010 server

Sponsored

Disk Usage Reports

Next, I would want to make sure there is plenty of disk space on my Exchange server. Again, WMI is the best solution here. Here’s a one line expression that I think will get you what you need.

When used in a PowerShell session, you get a result as in Figure 3.

Exchange 2010 server

I’ve formatted the size values in GB to make the result more meaningful. I‘ll want to watch that percent free value — I’ll have to take some action if it keeps dropping.

Sponsored

Database File Reports

But overall disk usage is only part of the picture. I should take a look at the Exchange database and log files. Using the Exchange management console I can get all the mailbox databases on my server.

The database object has properties for the file items I’m interested in.

You can see my result below.

Exchange 2010 server

However, I can’t simply run Get-ChildItem on that path because I’m running this from my client desktop and the path is relative to the server. I hate to have to log onto servers, so I’ll have to do a little PowerShell voodoo to get the database and log files using traditional PowerShell remoting.

The image below illustrates what kind of results I can expect.
Exchange 2010 server

With this, I can build a little PowerShell command to use in the Exchange management console to get database and log information.

This is definitely something you would want to drop in a script or function. I’m creating some custom properties for the file and folder sizes uses my remoting command. As you can see below, I probably have some overdue maintenance to do.

Exchange 2010 server

These are just a few server-related items you may wish to report on. For example, there is an entire library of performance counter information you may want to query. As with my mailbox reporting, I’ve been displaying formatted results to the screen, but you may elect to create HTML reports, Word documents, or archive to an XML file. PowerShell gives you options – sometimes the hardest task is deciding.

Sponsored

Tagged with ,