Solved

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

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

 

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

Integrate social media with email signatures

Is your company active on social media? Do you also use email signatures? Including social media icons in your email signature is a great way to get fans for free. Let all your email users know you’re on social media quickly and easily, in a single click.

Join & Write a Comment

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this video we show how to create a Shared 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 >> Sha…
In this video we show how to create an Address List 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 Organization >> Ad…

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now