Recently, I ran into a situation where my class discovery was not working and all I was getting back was a very generic 0x80004005 error:
I turned on a workflow trace, grabbed the ETL and received almost no help whatsoever:
[1]2616.1812::09/04/2014-08:52:02.023 [ModulesLibrary] [] [ModuleDebug] :CModuleHostDebug::NotifyError{ModuleDebug_cpp509}[DiscoveryDataSnapshotMapper] [IModuleHost->NotifyError] Module reported ModuleErrorSeverityDataLoss Message: <<Message cannot be displayed>> Source: Health Service Modules Id: -1073730742 Type: Warning Category: 0
<<Message cannot be displayed>> is not what I was hoping for from the normally very useful ETL. The only item I really take from the trace is that the problem is in the [DiscoveryDataSnapshotMapper]. The WMI query in this case actually looks like it returned exactly what I wanted.
Here’s the part of the discovery that would pertain to the mapper:
<ClassId>$MPElement[Name=”CE.TickDemoClass”]$</ClassId>
<InstanceSettings>
<Settings>
<Setting>
<Name>$MPElementName=”WindowsMicrosoft.Windows.Computer”]/PrincipalName$</Name>
<Value>$Target/PropertyType=”WindowsMicrosoft.Windows.Computer”]/PrincipalName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name=”CE.TickDemoClass”]/DDriveSize$</Name>
<Value>$Data/Property[@Name=’Size’]$</Value>
</Setting>
<Setting>
<Name>$MPElementName=”SystemSystem.Entity”]/DisplayName$</Name>
<Value>$Target/PropertyType=”WindowsMicrosoft.Windows.Computer”]/PrincipalName$</Value>
</Setting>
</Settings>
</InstanceSettings>
Just with a cursory skim, there does not appear to be anything wrong with the code. The custom class I created for demo purposes is simply a computer role class that gets populated if the machine has D: drive that is a logical disk. Upon closer review, the value that gets pushed into the DDriveSize attribute is the issue. At some point, the code was probably copied/pasted from either an advanced editor like Word or possible off the Interwebs. As such, at some point the single quotes have been converted to “smart quotes”.
Word or other advanced editor | Notepad |
After spending a few minutes reading on smart vs. dumb quotes on various different sites out there, it made me very thankful that our advanced editors just do in fact take care of much of this for us. Additionally, it makes me question whether or not I actually retained anything from 7th grade English class.
With that being said, the solution to the discovery is simple. Replace:
<Value>$Data/Property[@Name=’Size’]$</Value>
With:
<Value>$Data/Property[@Name=‘Size‘]$</Value>
Just one more thing to watch for from a management pack authoring perspective whenever copying and pasting code.