Source: http://www.ssas-info.com/analysis-services-scripts/1197-powershell-script-to-list-info-about-ssas-databases slightly modified
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
param($ServerName = "localhost", $dbname = "db_name") ## Add the AMO namespace $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 } foreach ($d in $server.Databases ) { if ($d.Name -ne $dbname) { continue; } Write-Output ( "Database: {0}; Status: {1}; Size: {2}MB" -f $d.Name, $d.State, ($d.EstimatedSize / 1024 / 1024).ToString("#,##0") ) foreach ($cube in $d.Cubes) { Write-Output ( " Cube: {0}" -f $Cube.Name ) foreach ($mg in $cube.MeasureGroups) { Write-Output ( " MG: {0}; Status: {1}; Size: {2}MB" -f $mg.Name.PadRight(25), $mg.State, ($mg.EstimatedSize / 1024 / 1024).tostring("#,##0")) foreach ($part in $mg.Partitions) { Write-Output ( " Partition: {0}; Status: {1}; Size: {2}MB" -f $part.Name.PadRight(35), $part.State, ($part.EstimatedSize / 1024 / 1024).ToString("#,##0") ) } # Partition } # Measure group foreach ($dim in $d.Dimensions) { Write-Output ( "Dimension: {0}" -f $dim.Name) } # Dimensions } # Cube } # Databases |