Using PowerShell to get current Data/Log/Temp and Backup Directories from SSAS

In a blog post from October 2015 I ranted about not being able to get the Data, Log, Temp and Backup directories from the AMO API. Back then, the I was tasked with mapping all of the possible locations for SSAS related files on a number of servers.
Obviously, a single attribute per location wouldn’t cut it, as locations may have been changed over time. At least that is what I observed on this setup. So, back then, I needed something more sophisticated.
Meanwhile I thought that this was a short coming of the AMO API, I filed a Connect item, in order for Microsoft to rectify this.

Just recently a reply was made to the Connect item, highlighting the fact, that the current values of the Data/Log/Temp and Backup Directories – meaning the currently configured values – is exposed through the Server.ServerProperties collection. According to the answer, only public property values are exposed.

Using PowerShell, we can now retrieve the desired information from any given instance of Analysis Services. Doing so would look something like this:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")

$serverName = "<insert server name here>";
$Server = New-Object Microsoft.AnalysisServices.Server;
$Server.Connect($serverName);
$prop_values = "";


$Server.ServerProperties["DataDir"].Value
$Server.ServerProperties["TempDir"].Value
$Server.ServerProperties["BackupDir"].Value
$Server.ServerProperties["LogDir"].Value

$Server.Disconnect();

$prop_values;

 

Loading

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.