Solved

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

Posted on 2010-11-11
7
972 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
  • 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Schedule Outlook Calendar 5 29
Add to XML (Powershell) 1 27
Exchange 2007 to 2013 - new servers and migrating users 4 22
Email forward and auto reply 4 34
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
In this video we show how to create a User Mailbox 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 >> Mailb…
In this video we show how to create a Contact 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 >> Contact ta…

808 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