Get Cube Status From PowerShell

Here is a neat little script; it get’s all the status info of an Analysis Service database instance and the cubes within that database. You should see that status ought to be “Processed” and if not, you know that something has gone wrong in your database. This script can be quite easily expanded into including dimensions, measure groups, partitions, but I personally split that out into different scripts otherwise the screen looks too full of info and you cannot see the forest for the trees.


[CmdletBinding()]
param(
[Parameter(Position=0,mandatory=$true)]
[string] $ssasInstance)

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$server = New-Object Microsoft.AnalysisServices.Server
$server.connect($ssasInstance)
$database=$server.databases
foreach ($db in $server.databases)
{
$dbwriteout = $db|select name,state
Write-host $dbwriteout -foregroundcolor darkgreen -backgroundcolor white
$Cubes=New-object Microsoft.AnalysisServices.Cube
$Cubes=$db.cubes
foreach ($cub in $cubes)
{
$cubewriteout = $Cub|select name,state,lastprocessed
write-host $db " " $cubewriteout -foregroundcolor darkgreen -backgroundcolor white
}
}

Once you have saved this to a .ps1 file you open up a PowerShell console and drag and drop the file there (or copy as path, whichever way you like) and press enter. It’ll ask you for the ssasInstance, and then hit enter and off it goes. The thing I like about checking cube status this way is that it is so much quicker than going through the UI.

If you like this then I’ve got a few other Powershell scripts for cube status querying/updating.

Find size of dimensions

Turn On Lazy Aggregations

Finding Unprocessed Objects

Process SSAS Databases Using PowerShell/a>

Author: Richie Lee

Full time computer guy, part time runner. Full time Dad, part time blogger. Knows a thing or two about Pokémon. Knows too much about SQL Agent. Writer of fractured sentences. Maker of the best damn macaroni cheese you've ever tasted.

One thought on “Get Cube Status From PowerShell”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s