If you have SQL Server Analysis Services (SSAS) and want to list the SSAS databases using PowerShell, here’s a PowerShell script that can do that:
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
# Variable for your SSAS server name
$SSASServerName = "ServerName"
# Connect to the SSAS server
$SSASServer = New-Object Microsoft.AnalysisServices.Server
$SSASServer.Connect($SSASServerName)
# Try to list the SSAS database Name
$SSASServer.Databases | Select Name
It turns out that you can do much more than listing your SSAS database name with this. You can get the SSAS database collation, compatibility level, created date, last processed, etc. To get the full list of properties that are available to you, try to run the following PowerShell script:
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
# Variable for your SSAS server name
$SSASServerName = "ServerName"
# Connect to the SSAS server
$SSASServer = New-Object Microsoft.AnalysisServices.Server
$SSASServer.Connect($SSASServerName)
# Try to list the SSAS database properties that are available to you
$SSASServer.Databases | Get-Member -MemberType property | FT -wrap | Out-String
So now, if I want to get a list of SSAS database name, collation, compatibility level, created data and last processed date, I can run the following PowerShell script:
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
# Variable for your SSAS server name
$SSASServerName = "ServerName"
# Connect to the SSAS server
$SSASServer = New-Object Microsoft.AnalysisServices.Server
$SSASServer.Connect($SSASServerName)
# Try to list the SSAS Database Name, Collation, Compatibility Level, Created Time, Estimated Size, Last Processed Date
$SSASServer.Databases | Select Name, Collation, CompatibilityLevel, CreatedTimeStamp, EstimatedSize, LastProcessed | FT -wrap | Out-String
No comments:
Post a Comment