Over the past few months I’ve been working on a lot of scripts for collecting SSAS-related configuration and performance information. So far, most of the scripting has been done via PowerShell (which I’m really starting to appreciate) but on a few rare occasions I’ve had to dip my toes into the ridiculously silly world of .NET … not enough to appreciate application developers (jk’ish) …but definitely enough to realize that the IDE for .NET developers is insanely better than anything I’ve seen/used for SQL/MDX/DAX/PowerShell developers.
Today’s post is just a quick (as the h@rdcor3 powershell devs would say) “PoSh” code-snippet for accessing SSAS instance configuration information via PowerShell.
$ssasInstanceName = "localhost" $loadAssembly = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") $svr = New-Object Microsoft.AnalysisServices.Server $svr.Connect($ssasInstanceName) $svr.Edition $svr.ProductLevel $svr.ProductName $svr.ServerMode $svr.ServerProperties
It’s rather useless in the form above but could easily be wrapped up into an enterprise-ready script for collecting and storing SSAS instance configuration information (as it should be for those who actually give a darn about having a well-documented environment).
That’s it – Happy Friday!
UPDATE 20151008: here’s an example where this snippet is being used in a more realistic scenario.