Solved

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

Posted on 2010-11-11
7
961 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
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.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
In this video we show how to create a mailbox database 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 Servers >> Data…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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