Symptoms
Assume that you use the Invoke-AsCmd cmdlet in PowerShell and XML for Analysis (XMLA) in SQL Server Management Studio (SSMS) for Microsoft SQL Server 2012 Analysis Services (SSAS 2012) or SQL Server 2014 Analysis Services (SSAS 2014) processing. In this situation, you experience the following behavior difference for the returned output:
-
When you use the following PowerShell command to capture warning messages:Invoke-Ascmd -InputFile:"<input.xmla>" -Server:"<servername>" -OutVariable out -WarningVariable w If the command receives any warning message, the warning message is not captured in the return code. However, the warning message is captured if you run the same XMLA command from SSMS.
-
When you use the following PowerShell command to capture error messages:Invoke-Ascmd -InputFile: :"<input.xmla>" -Server:"<servername>" -ErrorVariable e -OutVariable out -WarningVariable w If the command receives any error message, the error message is included in the Warning tag but is not captured in the return code. However, the error message is included in the Error tag and is captured in the return code if you run the same XMLA command from SSMS.
Cause
This issue occurs because the Invoke-AsCmd cmdlet ignores warning messages but captures error messages, and it uses wrong templates to generate return output.
Resolution
The issue was first fixed in the following cumulative update of SQL Server.
Cumulative Update 5 for SQL Server 2014 /en-us/help/3011055
Cumulative Update 2 for SQL Server 2012 SP2 /en-us/help/2983175
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.