Search code examples
sql-server-2012ssassqlpsascmd

sqlps Invoke-Ascmd Error Handling in ssas 2012


In SSAS 2012 Iam trying to use "sqlpls -C Invoke-ascmd -S server -i file.xmla" from command line for cube processing.%errorlevel% is 0 even if cube processing fails since sqlps executing succesfully.Can any one help me to understand how to do error handling for sqlps -C Invoke-ascmd in 2012?


Solution

  • SQLPS will always return 0 if the command executed successfully, it does not cares about whether the instruction are successful. All you need to do is get the output, using out-file option in ASCII code and check for tag. if found it will return 0 else it will return 1 for not found. Check the Findstr command from MS-DOS

    Example

    C:\>SQLPS -Invoke-Ascmd -Database blah blah....... ^| Out-File -encoding ASCII filename.xml