Processing SSAS Tabular Cube with Powershell

#load SSAS Assembly
$loadinfo = [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.AnalysisServices”)

# Instantiate a new instance of server
$server = New-Object Microsoft.AnalysisServices.Server

# connect to SSAS server
$server.connect(“JB1-SQLS-P03; Integrated Security=SSPI;”)
$db = $server.Databases.FindByName(“AdventureWorksDW2012”)

# Cube name is model by default in Tabular
$cube = $db.Cubes.FindByName(“Model”)

# Iterate MeasureGroups / Tables
foreach ($mg in $cube.MeasureGroups)
{
       # Iterate partitions in MeasureGroup
foreach ($part in $mg.Partitions)
{
$part.Process(“ProcessFull”) #process Data by making copy of partition
}
}
$Server.Disconnect()