OpsMgr 2007: Task results may return unformatted XML

image

When running one of the tasks in the action pane of System Center Operations Manager 2007, the results may be displayed in a window as unformatted XML. This is due to a SQL transform that was added in the RTM (original) version and was changed with Service Pack 1.  If you install a slipstream version of OpsMgr SP1 you will not see the issue.  Also note that in my experience, simply installing SP1 on top of an RTM installation will not resolve this either - you'll only avoid this if you install a slipstreamed SP1 version from scratch.

If you can't or didn't install a slipstream version of SP1 then you can run the following script in the SQL management studio to correct the issue:

use OperationsManager

if not exists
(
select * from dbo.UIDatatypeTransform inner join dbo.Datatype
on ( dbo.UIDatatypeTransform.DatatypeId = dbo.Datatype.DatatypeId )
where dbo.Datatype.DatatypeName = 'WorkflowsReport'
)
begin
insert into dbo.UIDatatypeTransform (DatatypeId, LanguageCode)
select DatatypeId, 'enu' from dbo.Datatype
where dbo.Datatype.DatatypeName = 'WorkflowsReport'
end

update dbo.UIDatatypeTransform
set Transform =
'<xsl:stylesheet version="2.0" xmlns:xsl="
https://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:xs=" https://www.w3.org/2001/XMLSchema" xmlns:fn=" https://www.w3.org/2004/07/xpath-functions" xmlns:xdt=" https://www.w3.org/2004/07/xpath-datatypes" xmlns:DataTypeTransformer="urn:DatatypeTransformer">
<xsl:variable name="DateAndTime">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">DateAndTime</xsl:with-param>
</xsl:call-template>Date and Time:
</xsl:variable>
<xsl:variable name="StatusFailed">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">StatusFailed</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="StatusRunning">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">StatusRunning</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="Count">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">Count</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="Details">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">Details</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="ShowHideString">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">ShowHideString</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="InstanceId">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">InstanceId</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="InstanceName">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">InstanceName</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="Workflows">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">Workflows</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="WorkflowId">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">WorkflowId</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="WorkflowName">
<xsl:call-template name="GetDisplayString">
<xsl:with-param name="Id">WorkflowName</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<!-- Returns the display string of the specified resouce -->
<xsl:template name="GetDisplayString">
<xsl:param name="Id" />
<xsl:value-of select="DataTypeTransformer:GetStringResource(''System.Health.Library'', ''9396306c2be7fcc4'', concat(''WorkflowsReport.'',$Id))" />
</xsl:template>
<xsl:template match="DataItem">
<xsl:element name="div">
<xsl:attribute name="align">left</xsl:attribute>
<xsl:attribute name="valign">top</xsl:attribute>
<xsl:attribute name="class">workflow</xsl:attribute>
<xsl:call-template name="CSS" />
<xsl:call-template name="ScriptFunctions" />
<xsl:element name="table">
<xsl:attribute name="class">mainTable</xsl:attribute>
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="$DateAndTime" />
<xsl:with-param name="TitleStyle" select="string(&quot;bold&quot;)" />
<xsl:with-param name="Value" select="DataTypeTransformer:FormatDateTime(@time)" />
</xsl:call-template>
<xsl:choose>
<xsl:when test="0 = ms:string-compare(string(Status), ''Failed'')">
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="$StatusFailed" />
<xsl:with-param name="TitleStyle" select="string(&quot;bold&quot;)" />
<xsl:with-param name="Value" select="Count" />
</xsl:call-template>
</xsl:when>
<xsl:when test="0 = ms:string-compare(string(Status), ''Running'')">
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="$StatusRunning" />
<xsl:with-param name="TitleStyle" select="string(&quot;bold&quot;)" />
<xsl:with-param name="Value" select="Count" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="$Count" />
<xsl:with-param name="TitleStyle" select="string(&quot;bold&quot;)" />
<xsl:with-param name="Value" select="Count" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- this deals with details -->
<xsl:if test="boolean(Details)">
<xsl:element name="tr">
<xsl:element name="td">
<xsl:attribute name="colSpan">2</xsl:attribute>
<xsl:element name="table">
<xsl:attribute name="id">
<xsl:text>Details</xsl:text>
</xsl:attribute>
<xsl:attribute name="class">innerTable</xsl:attribute>
<xsl:call-template name="TableToggleEntry">
<xsl:with-param name="Id" select="$Details" />
<xsl:with-param name="Title" select="$Details" />
</xsl:call-template>
<xsl:element name="tr">
<xsl:element name="td">
<xsl:attribute name="colspan">2</xsl:attribute>
<xsl:for-each select="Details/Instance">
<xsl:element name="table">
<xsl:attribute name="id">
<xsl:text>Instance</xsl:text>
<xsl:value-of select="@Id" />
</xsl:attribute>
<xsl:attribute name="class">innerTable1</xsl:attribute>
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="$InstanceId" />
<xsl:with-param name="TitleStyle" select="string(&quot;bold&quot;)" />
<xsl:with-param name="Value" select="@Id" />
</xsl:call-template>
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="$InstanceName" />
<xsl:with-param name="TitleStyle" select="string(&quot;bold&quot;)" />
<xsl:with-param name="Value" select="DataTypeTransformer:GetObjectDisplayName(@Id)" />
</xsl:call-template>
<xsl:call-template name="TableToggleEntry">
<xsl:with-param name="Id" select="@Id" />
<xsl:with-param name="Title" select="$Workflows" />
</xsl:call-template>
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="$WorkflowId" />
<xsl:with-param name="Value" select="$WorkflowName" />
<xsl:with-param name="RowStyle" select="string(&quot;none&quot;)" />
<xsl:with-param name="TitleStyle" select="string(&quot;bold&quot;)" />
<xsl:with-param name="ValueStyle" select="string(&quot;bold&quot;)" />
</xsl:call-template>
<xsl:for-each select="Workflow">
<xsl:call-template name="TableEntry">
<xsl:with-param name="Title" select="." />
<xsl:with-param name="Value" select="DataTypeTransformer:GetWorkflowDisplayNameFromString(.)" />
<xsl:with-param name="RowStyle" select="string(&quot;none&quot;)" />
</xsl:call-template>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="TableToggleEntry">
<xsl:param name="Id" />
<xsl:param name="Title" />
<xsl:element name="tr">
<xsl:attribute name="id">
<xsl:value-of select="$Id" />
</xsl:attribute>
<xsl:element name="td">
<xsl:attribute name="colspan">2</xsl:attribute>
<xsl:element name="p">
<xsl:element name="b">
<xsl:value-of select="$Title" />
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="onclick">
<xsl:text>ToggleDisplayMode(''</xsl:text><xsl:value-of select="$Id" /><xsl:text>'')</xsl:text>
</xsl:attribute>
<xsl:element name="u">
<xsl:value-of select="$ShowHideString" />
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="TableEntry">
<xsl:param name="Title" />
<xsl:param name="Value" />
<xsl:param name="RowStyle" />
<xsl:param name="TitleStyle" />
<xsl:param name="ValueStyle" />
<xsl:element name="tr">
<xsl:if test="string($RowStyle)">
<xsl:attribute name="style">
<xsl:text>display:</xsl:text>
<xsl:value-of select="string($RowStyle)" />
</xsl:attribute>
</xsl:if>
<xsl:element name="td">
<xsl:choose>
<xsl:when test="string($TitleStyle)">
<xsl:attribute name="class">boldColumn</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$Title" />
</xsl:element>
<xsl:element name="td">
<xsl:choose>
<xsl:when test="string($ValueStyle)">
<xsl:attribute name="class">boldColumn</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:value-of select="$Value" />
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="ScriptFunctions">
<xsl:element name="script"><![CDATA[ function ToggleDisplayMode(node) { var tableHeader = document.getElementById(node); var row = tableHeader.nextSibling; while (row != null) { if ( row.style.display != "none" ) { row.style.display = "none"; } else { row.style.display = ""; } row = row.nextSibling; } } ]]></xsl:element>
</xsl:template>
<xsl:template name="CSS">
<xsl:element name="style"> .workflow .mainTable { width: 100%; border-style: none; border-collapse: collapse; } .workflow td { text-align: left; vertical-align: top; color: gray; } .workflow .boldColumn { text-align: left; vertical-align: top; font: bold; color: #696969; } .workflow .innerTable { width: 100%; border-style: none; border-collapse: collapse; } .workflow .innerTable1 { width: 100%; border:solid black 1.0pt; border-collapse: collapse; } .workflow b { text-align: left; vertical-align: top; font: bold; color: #696969; } .workflow u { color: blue; } </xsl:element>
</xsl:template>
</xsl:stylesheet>'

from dbo.UIDatatypeTransform
inner join dbo.Datatype
on ( dbo.UIDatatypeTransform.DatatypeId = dbo.Datatype.DatatypeId )
where dbo.Datatype.DatatypeName = 'WorkflowsReport'

Hope this helps,

Sam Allen | Senior Support Escalation Engineer