Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-11-26
6
Medium Priority
?
344 Views
Last Modified: 2014-11-27
Folks,

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 {
      param(
        $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.

Thanks,
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 16

Assisted Solution

by:Rajitha Chimmani
Rajitha Chimmani earned 1000 total points
ID: 40468391
With Exchange 2010 whitespace is not calculated using any events. Its extracted from a command itself..just a single command.

Get-MailboxServer servername | Get-MailboxDatabase | ft Name,AvailableNewMailboxSpace
0
 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 40468398
Thanks Rajitha,

I'm not sure what happened to my Exchange Server 2010, but somehow by executing the Full List option as per below:

Get-MailboxServer | Get-MailboxDatabase | fl

Open in new window


The following attributes value is empty:

DatabaseSize                                 : 
AvailableNewMailboxSpace                     : 

Open in new window

0
 
LVL 7

Expert Comment

by:jimmithakkar
ID: 40468439
Hi,

exchange 2010 sp1 it self bug while checking AvailableNewMailboxSpace on more database through EMS power shell,
Need to upgrade with rollup 6 or SP2


Thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:Senior IT System Engineer
ID: 40468442
my exchange server version is below:

Exchange Server 2010 Version: 14.02.0387.000 (Build 247.5)

is that affected ?
0
 
LVL 31

Accepted Solution

by:
Gareth Gudger earned 1000 total points
ID: 40468503
Hey ITSystemEngineer,

You are on SP2. And I just confirmed this works on SP1 as well in my lab.

Try the following command. Its missing the -Status switch.

Get-MailboxServer servername | Get-MailboxDatabase -Status | ft Name,AvailableNewMailboxSpace
0
 
LVL 8

Author Closing Comment

by:Senior IT System Engineer
ID: 40469806
Thanks !
I didn't know if the new Exchange Server 2010 requires the Server name or additional parameter "-Status" to populate the attributes.
0

Featured Post

Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question