Public/Get-SSASTabularDatabases.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function Get-SSASTabularDatabases{
param($serverName)

try{
    Write-Log "loading Microsoft.AnalysisServices assemblies that we need" Debug
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.Core") | Out-Null
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.Tabular") | Out-Null
}
catch{
    Write-Log "Could not load the needed assemblies... TODO: Figure out and document how to install the needed assemblies. (I would start with the SQL feature pack)" Error -ErrorAction Stop
}

$server = New-Object Microsoft.AnalysisServices.Tabular.Server
$server.Connect($serverName)

Write-Output $server.Databases
} Export-ModuleMember -function Get-SSASTabularDatabases