I run the following command to process a database/and its partitions.
Invoke-ASCmd –InputFile $file -Server $Server >$output
from the output, if there is an error, this is whats displayed:
<return xmlns="urn:schemas-microsoft-com:xml-analysis"><root xmlns="urn:schemas-microsoft-com:xml-analysis:empty"><Excep
tion xmlns="urn:schemas-microsoft-com:xml-analysis:exception" /><Messages xmlns="urn:schemas-microsoft-com:xml-analysis:
exception"><Error ErrorCode="-1055653884" Description="Either the dimension with the ID of '0f585685' does not exist in the database with the ID of '', or the u
ser does not have permissions to access the object." Source="Microsoft SQL Server 2017 Analysis Services" HelpFile="" />
</Messages></root></return>
can i extract the description
part since its the most useful?
i want to extract it to have meaningful email messages with errors that can be understood right away without having to search through the whole other XML mess
$Email_Body = Get-Content -Path $output | Out-String
essentially, the email would have:
Either the dimension with the ID of '0f585685' does not exist in the database with the ID of '', or the u ser does not have permissions to access the object.
also some outputs sometimes contain multiple errors/descriptions.
how would i handle that?
for example:
<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="-1055784933" Description="[Teradata Database] [8017] The UserId, Password or Account is invalid.. The exception was raised by the IDbConnection interface." Source="Microsoft SQL Server 2017 Analysis Services" HelpFile="" /><Error ErrorCode="-1055784860" Description="A connection could not be made to the data source with the DataSourceID of '', Name of 'Teradata '." Source="Microsoft SQL Server 2017 Analysis Services" HelpFile="" /></Messages></root></return>
can all descriptions be stored as part of $Email_body
and sent? so in this case, it would be:
[Teradata Database] [8017] The UserId, Password or Account is invalid.. The exception was raised by the IDbConnection interface.
A connection could not be made to the data source with the DataSourceID of '', Name of 'Teradata '.