Get-ExchangeDatabase
Exchange: Lists all Mailbox Databases
#Requires -Version 5.1
[CmdletBinding()]
Param (
[string]$Identity,
[switch]$IncludeStatus
)
Process {
try {
$params = @{
'ErrorAction' = 'Stop'
}
if ($Identity) { $params.Add('Identity', $Identity) }
if ($IncludeStatus.IsPresent) { $params.Add('Status', $true) }
$databases = Get-MailboxDatabase @params
$results = foreach ($db in $databases) {
[PSCustomObject]@{
Name = $db.Name
Server = $db.Server.Name
Recovery = $db.Recovery
CircularLoggingEnabled = $db.CircularLoggingEnabled
DatabaseSize = if ($db.DatabaseSize) { $db.DatabaseSize.ToGB() } else { "N/A" }
Mounted = $db.Mounted
LastModified = $db.WhenChanged
}
}
Write-Output ($results | Sort-Object Name)
}
catch {
throw
}
}Optional. Specifies the Identity of a specific database to retrieve.
Off
If set, retrieves detailed health and replication status (On-Premises only).