SSAS info o bazach (wielkość bazy, partycji, statusu procesowania etc.)

Źródło: http://www.ssas-info.com/analysis-services-scripts/1197-powershell-script-to-list-info-about-ssas-databases

 

lekko zmodyfikowany

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

 

Dodaj komentarz