troubleshooting Question

Modifying powershell script to calculate the white space on Exchange Server 2010 using the script for Exchange Server 2007 ?

Avatar of Senior IT System Engineer
Senior IT System EngineerFlag for Australia asked on
ExchangeActive DirectoryPowershell
6 Comments2 Solutions375 ViewsLast Modified:

I need your help and suggestion in modifying the below Powershell script so that it can be used against Exchange Server 2010:

function Get-ExchangeWhiteSpace {
        $ComputerName = $(throw "ComputerName cannot be empty.")

      # Convert Dates to WMI CIM dates
            $tc = [System.Management.ManagementDateTimeconverter]
            $Start = $tc::ToDmtfDateTime( (Get-Date).AddDays(-10).Date )
            $End = $tc::ToDmtfDateTime( (Get-Date).Date)

      # Create two calculated properties for InsertionStrings values
            $DB = @{Name="DB";Expression={$_.InsertionStrings[1]}}
            $FreeMB = @{Name="FreeMB";Expression={[int]$_.InsertionStrings[0]}}

      Get-WMIObject Win32_NTLogEvent -ComputerName $ComputerName -Filter "LogFile='Application' AND EventCode=1221 AND TimeWritten>='$Start' AND TimeWritten<='$End'" |
        Select-Object ComputerName,$DB,$FreeMB, @{Name="TimeWritten"; Expression = {$_.ConvertToDateTime($_.TimeWritten )}} |
              Group-Object ComputerName, DB |
              % { $_.Group | Sort-Object TimeWritten -Descending | select -first 1 } | Sort-Object FreeMB -Descending

Get-ExchangeWhiteSpace -ComputerName PRODMAILBOX02-VM | ft -AutoSize

The above script works with no issues in Exchange Server 2007 but not in 2010.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros