Si vous souhaitez savoir l'espace occupé dans les bases de données et sur les disques par vos différentes banques Exchange, vous pouvez utiliser le script suivant:
function CheckExchangeSpace{
$global:DiskSpace=@()
$TotalSize=0
$global:StatsGlobals=@()
$global:StatsUsers=@()
$global:DBs=Get-MailboxDatabase
foreach ($DB in $DBs){
$items=($DB |Get-Mailbox|Get-MailboxStatistics)
$TotalDBSize=0
if($items -ne $null){
foreach ($item in $items){
if($item -ne $null){
$TotalDBSize+=$item.TotalItemSize.Value.ToBytes()
$TotalDBSize+=$item.TotalDeletedItemSize.Value.ToBytes()
$e=New-Object PSObject
$e | Add-Member -Name DisplayName -MemberType NoteProperty -Value $item.DisplayName
$e | Add-Member -Name ItemCount -MemberType NoteProperty -Value $item.ItemCount
$e | Add-Member -Name ItemSize -MemberType NoteProperty -Value $item.TotalItemSize.Value.ToMB()
$e | Add-Member -Name DeletedItemSize -MemberType NoteProperty -Value $item.TotalDeletedItemSize.Value.ToMB()
$e | Add-Member -Name TotalItemSize -MemberType NoteProperty -Value ($item.TotalItemSize.Value.ToMB() + $item.TotalDeletedItemSize.Value.ToMB())
$e | Add-Member -Name Database -MemberType NoteProperty -Value $item.Database
$global:StatsUsers+=$e
}
}
}
$EDBPath="\\"+$DB.Server.name+"\"+($DB.EdbFilePath.PathName).Replace(":","$")
$TailleEDBDisque=(get-item $EDBPath).length/1MB
$MySize=0
$EDBLogPath="\\"+$DB.Server.name+"\"+($DB.LogFolderPath.PathName).Replace(":","$")
Get-ChildItem $EDBLogPath -Filter "*.log" | foreach { $MySize+=$_.length }
$TailleLOGSDisque=$MySize/1MB
[int]$TotalFBSizeMB=($TotalDBSize/1024)/1024
$Delta=$TailleEDBDisque-$TotalFBSizeMB
$d=New-Object PSObject
$d | Add-Member -Name Nom -MemberType NoteProperty -Value $DB.Identity
$d | Add-Member -Name TailleElements -MemberType NoteProperty -Value $TotalFBSizeMB
$d | Add-Member -Name TailleEDBDisque -MemberType NoteProperty -Value $TailleEDBDisque
$d | Add-Member -Name Delta -MemberType NoteProperty -Value $Delta
$d | Add-Member -Name TailleLOGSDisque -MemberType NoteProperty -Value $TailleLOGSDisque
$global:StatsGlobals+=$d
$TotalSize+=$TotalFBSizeMB
}
ForEach($MyServer in Get-ExchangeServer){
$global:DiskSpace+=Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" -computer $MyServer | Select @{Name=”Server Name”;Expression={$MyServer}},DeviceID,VolumeName,@{Name=”Size(GB)”;Expression={“{0:N1}” -f($_.size/1gb)}},@{Name=”Freespace(GB)”;Expression={“{0:N1}” -f($_.freespace/1gb)}},@{Name=”Free Space(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb) / ($_.size/1gb))}}
}
$DBs|ft
$StatsUsers|ft
$StatsGlobals|ft
$DiskSpace|ft
Write-Host "Top 10 des Nombres d'elements:"
$StatsUsers | Sort-Object ItemCount -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
Write-Host "Top 10 des tailles de boite:"
$StatsUsers | Sort-Object ItemSize -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
Write-Host "Top 10 des tailles d'elements supprimés:"
$StatsUsers | Sort-Object DeletedItemSize -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
}
CheckExchangeSpace
$DBs|ft
$StatsUsers|ft
$StatsGlobals|ft
$DiskSpace|ft
Et pour avoir le top 10:
Write-Host "Top 10 des Nombres d'elements:"
$StatsUsers | Sort-Object ItemCount -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
Write-Host "Top 10 des tailles de boite:"
$StatsUsers | Sort-Object ItemSize -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
Write-Host "Top 10 des tailles d'elements supprimés:"
$StatsUsers | Sort-Object DeletedItemSize -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
mardi 24 janvier 2012
Connaitre l'espace occupé par les mails
Inscription à :
Publier les commentaires (Atom)
Et pour avoir le top 10:
RépondreSupprimerWrite-Host "Top 10 des Nombres d'elements:"
$StatsUsers | Sort-Object ItemCount -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
Write-Host "Top 10 des tailles de boite:"
$StatsUsers | Sort-Object ItemSize -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
Write-Host "Top 10 des tailles d'elements supprimés:"
$StatsUsers | Sort-Object DeletedItemSize -descending |Select-Object DisplayName,ItemCount,ItemSize,DeletedItemSize,TotalItemSize,Database -first 10 | ft
Le script à été modifié pour prendre en charge pleinement les Cluster DAG
RépondreSupprimer