Deleting SSAS Cube Partitions Using PowerShell and AMO
I've really developed a jones for using PowerShell to make painful, repetitive, time consuming tasks much quicker. PowerShell's great for automation, but it's also great for running tasks on an adhoc basis. Recently I had to delete about 600 partitions from a measure group that had thousands of partitions. Doing this manually would be ridiculous, so I created a sql script that used some dynamic -tsql to create the delete commands in xmla. I shared this as a post, and mused that if I had to run this more than once I'd create a Powershell script. Funnily enough, that is exactly what I had to do, and a weakness in using t-sql/xmla became apparent; if one of the partitions did not exist in the measure group then the xmla script would fail. So I needed to make a robust script, and using xmla was no longer an option as there is no "if exists" option.
Read more...Tags: partition, amo, script, powershell