Created
July 15, 2015 10:14
-
-
Save ghotz/369ac83ccfd8d8836061 to your computer and use it in GitHub Desktop.
Get Analysis Services databases size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param($ServerName="GSRVBI1") | |
cls | |
$loadInfo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") | |
$server = New-Object Microsoft.AnalysisServices.Server | |
$server.connect($ServerName) | |
if ($server.name -eq $null) { | |
Write-Output ("Server [{0}] not found" -f $ServerName) | |
break | |
} | |
$sum = 0 | |
foreach ($d in $server.Databases) | |
{ | |
Write-Output ("Database: {0}; Status: {1}; Size: {2}MB" -f $d.Name, $d.State, ($d.EstimatedSize/1024/1024).ToString("#,##0")) | |
$sum = $sum + $d.EstimatedSize / 1024 / 1024 | |
} | |
Write-Output ("Total size: {0}MB" -f $sum.ToString("#,##0")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment