Solved

PowerShell script that displays Exchange 2003 mail store deleted items disk consumption

Posted on 2010-11-11
7
982 Views
Last Modified: 2012-06-27
I would like to execute a Powershell script that would display the disk space consumed its mailboxes deleted items.  Currently my Exchange environment is 2003; therefore, I am unable run to utilize the commands available to Exchange 2007.
0
Comment
Question by:jahhan
[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
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:Gitcho
ID: 34117837
#the exchange server name
$exchangeServer = "SERVER01"
#get all mailboxes
$2003server = Get-Wmiobject -namespace root\MicrosoftExchangeV2 -class Exchange_Mailbox -computer $exchangeServer
#strip system mailboxes
$2003server = ($2003server | ? {$_.DisplayName -notlike "SystemMailbox*"})
#calculate total size of deleted items
$deletedTotal = ($2003server | Measure-Object DeletedMessageSizeExtended -Sum).Sum
#total size in MB
([math]::round(($deletedTotal/1MB), 2))
0
 

Author Comment

by:jahhan
ID: 34122342
This is what I need, however, is it possible to list the server values individually?  So far, when i run the script, it provides one value.
0
 
LVL 5

Expert Comment

by:Gitcho
ID: 34123112
Not sure what you mean ... this script is only querying one server - so there is only 1 server value.   If you want to output the server name along with the total deleted items space, just change the last line to:

Write-Host $exchangeServer " has a total of " ([math]::round(($deletedTotal/1MB), 2)) "MB of delete items"

Open in new window


If you're asking to output the value of each USER's delete item total, then add this line:

$2003server | % { Write-Host ($_.MailboxDisplayName)":"([math]::round(($_.size/1KB), 2))  }

Open in new window


0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

Author Comment

by:jahhan
ID: 34123471
I have multiple servers listed in the $exchangeservers line, but when I run the script only one value is displayed, and this value seem as if its the total off all the servers values.
0
 
LVL 5

Accepted Solution

by:
Gitcho earned 500 total points
ID: 34123690
OK.  try this :

#load server names from file
$exchangeServer = gc "c:\files\list_of_servers_to_check.txt" #one server name on each line
#process each server
Foreach ($server in $exchangeServer) { 
	#get all mailboxes 
	$2003server = Get-Wmiobject -namespace root\MicrosoftExchangeV2 -class Exchange_Mailbox -computer $server
	#strip system mailboxes
	$2003server = ($2003server | ? {$_.DisplayName -notlike "SystemMailbox*"})
	#calculate total size of deleted items
	$deletedTotal = ($2003server | Measure-Object DeletedMessageSizeExtended -Sum).Sum
	#total size in MB
	Write-Host $server " has a total of " ([math]::round(($deletedTotal/1MB), 2)) "MB of deleted items"
}

Open in new window

0
 

Author Comment

by:jahhan
ID: 34124013
Thanks for the script, is it possible to remove the write-host line and add script that will display the output on the results screen?
0
 
LVL 5

Expert Comment

by:Gitcho
ID: 34125706
The write-host line *does* display the output on the screen.  If you don't want to display anything to the screen just delete that last line.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

749 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