调用ASCmd在PowerShell中返回错误/警告

调用ASCmd在PowerShell中返回错误/警告,powershell,azure-devops,ssas,Powershell,Azure Devops,Ssas,在我的部署管道中运行PowerShell: Write-Host "Invoking deployment script... This may take several minutes." Invoke-ASCmd -Server:$SsasServer -InputFile $path\$bim.xmla | Out-File $path\$bim.xml Write-Host "Please check $path\$bim.xml as this is output of this de

在我的部署管道中运行PowerShell:

Write-Host "Invoking deployment script... This may take several minutes."
Invoke-ASCmd -Server:$SsasServer -InputFile $path\$bim.xmla | Out-File $path\$bim.xml
Write-Host "Please check $path\$bim.xml as this is output of this deployment"
我想获取Invoke ASCmd的输出文件:$bim.xml,并确定是否存在警告或错误。将警告消息返回到my azure管道中的控制台将是理想的选择

警告消息示例:

<return xmlns="urn:schemas-microsoft-com:xml-analysis"><root xmlns="urn:schemas-microsoft-com:xml-analysis:empty"><Exception xmlns="urn:schemas-microsoft-com:xml-analysis:exception" /><Messages xmlns="urn:schemas-microsoft-com:xml-analysis:exception"><Error ErrorCode="-1055784777" Description="The JSON DDL request failed with the following error: Failed to execute XMLA. Error returned: &#39;The column &#39;ProcessDateKey&#39; in table &#39;Financial Measures&#39; has invalid bindings specified.
&#39;.." Source="Microsoft SQL Server 2016 Analysis Services Managed Code Module" HelpFile="" /></Messages></root></return>
[xml]$XmlDocument = Get-Content -Path $path\$bim.xml
if($XmlDocument.return.root.Messages.Error){
    foreach ($errorMessage in $XmlDocument.return.root.Messages.Error ){
        $message = $errorMessage.Description
        Write-Error $message
    }
    exit 1
}