Powershell Script I wrote\stole.  Works in Ex2007 with Powershell 2.0.  It 
needs some modifications on the order of application entries it brings into the 
array but it will get you going.




#////startscript

#Need Power Shell Version 2.0

# Note: Event ID 1221 has an InstanceID of 1074136261 on both MSX 2007 and MSX 
2003 servers. 
#
#########Vairables#############
# $es = Servers Array         #
# $srv = Servername           #
# $dbc = Database Count       #
# $DB = Database Name         #
# $WS = WhiteSpace            #
###############################


#Create File for Output
$fileName=read-host "Enter the File Name where the information will be stored:"
$File=New-Item -ItemType file "$FileName.txt"

#Adds Header Info to file
add-content $file Server"       "DateBase"      "NumberOfUsers" "DataBaseSize"  
"WhiteSpace


#Gets All Exchange Servers with the Mailbox Role including Public Folders
$es = Get-ExchangeServer | Sort-Object -Property name | Where-Object 
{$_.ServerRole -eq "Mailbox"}

 

foreach ($srv in $es) 
{ 
#Getting the database count
$dbc = get-mailboxdatabase -server $srv |Measure-Object


#Getting the 1221 events. 
#need to modify the following line in order to only get correct app entries
$events = Get-EventLog -ComputerName $srv -LogName application -instanceid 
1074136261 -source "MSExchangeIS Mailbox Store" -Newest $dbc.count| 
Sort-Object -Property Message 

#Writing the output to Screen
Write-Host "" 
Write-Host "Server -" $srv -ForegroundColor Blue 
Write-Host "Databases -" $dbc.Count -ForegroundColor Blue 
Write-Host "" 


foreach ($item in $events) 
{ 
$DBName = $item.ReplacementStrings[1] 
$WS = $item.ReplacementStrings[0] 


$database1=$DBName

        #Getting File Size of Databases
        $db = Get-MailboxDatabase $srv"\"$Database1
        #write-host $db
        $path = "`\`\" + $srv + "`\" + 
$db.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ 
$db.EdbFilePath.PathName.Remove(0,2)
        
                $dbsize = Get-ChildItem $path
                $ReturnedObj = New-Object PSObject
                #$ReturnedObj | Add-Member NoteProperty -Name 
"Server\StorageGroup\Database" -Value $objItem.Identity
                #$ReturnedObj | Add-Member NoteProperty -Name "Size (MB)" 
-Value ("{0:n2}" -f ($dbsize.Length/1024KB))
                #$ReturnedObj | Add-Member NoteProperty -Name " " -Value 
("{0:n2}" -f ($dbsize.Length/1024KB))

                $ReturnedOBJ = ("{0:n2}" -f ($dbsize.Length/1024KB))
                
                
                
#Getting Number of Users on Databases           
$NuUsers=Get-MailboxStatistics -database $srv"\"$Database1 |where-object 
{!$_.DisconnectDate} | group-object -property:displayName |Measure-Object
$NumBerOfUSers=$NuUsers.Count

#Writing to Screen      
        Write-Host
        Write-Host "ServerName  "$srv
        Write-Host "DBName      "$DBName
        write-host "NmbrUsers   "$NumberOfUsers
        Write-Host "SizeOfDB    "$ReturnedObj
        Write-Host "WhtSpace    "$WS
        Write-Host

#Writing to File        
add-content $file $srv" "$DBName"       "$NumberOfUsers"        "$ReturnedObj"  
"$WS


} 
}



#////endscript





_______________________________________ 
Clint Kleciak
Infrastructure Engineer Mgr
CIGNA IT

Confidential, unpublished property of CIGNA. Do not duplicate or distribute. 
Use and distribution limited solely to authorized personnel. (c) Copyright 2010 
CIGNA

-----Original Message-----
From: Ellis, John P. [mailto:johnel...@wirral.gov.uk] 
Sent: Friday, July 23, 2010 5:02 AM
To: MS-Exchange Admin Issues
Subject: Exchange 2003 whitespace

Is it possible to obtain free disc space, EDB size, and white space from
the command line and export it to a file?

Thanks
John
-------------------------------------------------------------------

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.clearswift.com
**********************************************************************







------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error, please 
immediately notify the sender by e-mail at the address shown.  This email 
transmission may contain confidential information.  This information is 
intended only for the use of the individual(s) or entity to whom it is intended 
even if addressed incorrectly.  Please delete it from your files if you are not 
the intended recipient.  Thank you for your compliance.  Copyright 2010 CIGNA
==============================================================================



Reply via email to