The script wll return those values like in 3th line of it, so there will be: Storage group name, sum of all mailboxes (in megabytes), sum of all deleted items (in megabytes), size of the *.edb database file, and the amount of white space in each storage group.
$data = Get-Date –f "yyyy-MM-dd";
$MailboxServer = "Here enter the name of your mailbox server"
out-file -filepath StorageGroupsReport_$data.txt -append -inputobject "Storage GRoup Name ($elem);Sum for all mailboxes (MB) ($suma);Sum of all deleted elements (MB) ($sumdel);Database file size (MB) ($sumadb);Sum of White Space (MB) ($SG_WS)"
foreach ($elem in Get-MailboxDatabase){
$elem
$SG_MB = (Get-Mailbox -ResultSize Unlimited -Database "$elem" | get-mailboxstatistics | measure-object totalitemsize -sum)
$suma = "{0:N2}" -f ($SG_MB.sum / 1MB)
$SGdel_MB = (Get-Mailbox -ResultSize Unlimited -Database "$elem" | get-mailboxstatistics | measure-object totaldeleteditemsize -sum)
$sumadel = "{0:N2}" -f ($SGdel_MB.sum / 1MB)
$SGDB_MB = (Get-MailboxDatabase "$elem" | foreach-object {add-member -inputobject $_ -membertype noteproperty -name mailboxdbsizeinGB -value ([math]::Round(([int64](get-wmiobject cim_datafile -computername $_.server -filter ('name=''' + $_.edbfilepath.pathname.replace("\","\\") + '''')).filesize / 1mb),2)) -passthru} | measure-object mailboxdbsizeinGB -sum)
$sumadb = "{0:N2}" -f ($SGDB_MB.sum)
$dt = $elem.name
$s = (get-eventlog Application -ComputerName $MailboxServer -instanceID 1074136261 -Message "*$dt*" -newest 1 | select -expand message )
$d = ($s.IndexOf(" megabytes") - $s.IndexOf("`has "))
$SG_WS = ($s.Substring($s.IndexOf("has "),$d).trim("has "))
$SG_WS
out-file -filepath StorageGroupsReport_$data.txt -append -inputobject "$elem;$suma;$sumadel;$sumadb;$SG_WS"
}
Brak komentarzy:
Prześlij komentarz