次の方法で共有


Retreive Analysis Services warning with powershell

One great feature of Analysis Services is to give warning about your cube design during the design of your cube.

These warning can be retreive after you have deployed your cube on the Analysis Services Server.

 

here is a sample script to retreive these warning :

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$serverAS = New-Object Microsoft.AnalysisServices.Server
$serverAS.connect("ServerName")
$db = $serverAS.databases["DatabaseName"]

$val = new-object Microsoft.AnalysisServices.ValidationResultCollection

foreach ($dim in $db.dimensions)
{
 write-host "Validation dimension : ", $dim.name
 $dim.validate($val, 4)
}

foreach ($cube in $db.cubes)
 {
  write-host "validation cube : ", $cube.name
 $cube.validate($val, 4)
 foreach ($mg in $cube.measuregroups)
  {
   write-host "validation measuregroup : ", $mg.name
   $mg.validate($val, 4)
   foreach ($partition in $mg.partitions)
    {
     write-host "validation partition : ", $partition.name
     $partition.validate($val, 4)
    }
  }
 }

$val | select source, sourcePath, sourceTYpe, description

 Enjoy !