Skip to content

Instantly share code, notes, and snippets.

@bobfrankly
Created August 21, 2017 22:05
Show Gist options
  • Save bobfrankly/5f9f3d4af0a5c9e4eec50d163b135499 to your computer and use it in GitHub Desktop.
Save bobfrankly/5f9f3d4af0a5c9e4eec50d163b135499 to your computer and use it in GitHub Desktop.
Exchange 2010 Database filespace details
function Get-DBData{
$mailBoxDBs = Get-Mailboxdatabase -status | select *
foreach ($mbdb in $mailBoxDBs){
$thisDBdrive = $mbdb.edbfilepath.tostring().split(":")[0]
$thisDriveFree = invoke-command -ComputerName $mbdb.server -ArgumentList $thisDBdrive -ScriptBlock {param($drive) get-PSDrive $drive | select @{name="FreeGB";expression={[math]::round(($_.free / 1GB),2)}}} | select -expand FreeGB
$mbdb | select name, Databasesize, AvailableNewMailboxSpace, @{name="DriveFreeGB";expression={$thisdrivefree}}, server
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment