Reputation: 775
I'm attempting to process cubes and dimensions in powershell. It has been working for awhile but all of a sudden it stops. I can process the dimensions and cubes in visual studio but processing them with a powershell script in the same order gives me a duplicate attribute key error.
Powershell Script:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$serverAS = New-Object Microsoft.AnalysisServices.Server
$serverAS.connect("SERVER")
$db = $serverAS.databases["ANALYSIS DB"]
$db.cubes | select name, storagemode, lastprocessed
$db.dimensions | select name, isparentchild, lastprocessed, storagemode
Foreach ($c in $db.dimensions) {$c.process("ProcessFull")}
Foreach ($c in $db.cubes) {$c.process("ProcessFull")}
Upvotes: 1
Views: 653
Reputation: 775
Thanks for the response. I was actually able to get around this by using SSDT and Integration Services to process Dimensions and Cubes.
Upvotes: 0
Reputation: 80
You need to ignore the key errors like this:
## Set up the Error Configuration so that Key Errors are ignored
$errorConfig = New-Object `
Microsoft.AnalysisServices.ErrorConfiguration("D:\ProcessLogs\")
$errorConfig.KeyNotFound = "ReportAndContinue"
$errorConfig.KeyErrorAction = "ConvertToUnknown"
$errorConfig.KeyErrorLimit = -1
and then process with this error config parameter:
## Process the current database
$c.Process("ProcessFull", $errorConfig)
Reference and Example: http://www.biadmin.com/2012/07/bi-admin-scripts-process-ssas-database.html
Upvotes: 1