Despite its name, the client messaging SDK also has some strictly server side functionality. In its original release with the ConfigMgr 2012 SDK, it could write state messages and status messages directly to the inboxes on the site server. In the SP1 SDK, you can now write DDR messages directly to the site inboxes. This is equivalent to the functionality provided by the old SmsResGenCtl.dll COM library, but is a fully managed solution that doesn’t require any COM registrations or extra libraries.
The old library provided the ability to formulate a completely ad-hoc DDR which could be used to extend resource discovery by being able to add resources into Configuration Manager for objects and their properties that aren’t natively supported. For example, you could inventory your fax machines, printers, chairs (someone actually asked for this once!), and so on.
The class of interest for generating this inventory data is Microsoft.ConfigurationManagement.Messaging.Messages.Server.DiscoveryDataRecordFile.
Here is a code sample on how you may inventory a printer using this API:
Pretty simple, right? Basically you define your properties, flags if needed, a maximum length where applicable, and then values. The Architecture field is very important as it will create SMS_R_Architecture resource tables that can be used for collections and query rules. In this sample because the architecture is “Printer”, a SMS_R_Printer class will be created.
The sample here used SerializeToFile to write a file for testing purposes and you’d drop this file into your ddm.box inbox on your site server. A better way to do this is to use the SerializeToInbox method that will automatically drop the file into the appropriate inbox.
Running this program and dropping the .DDR file into ddm.box will create an inventory record (which can be verified via ddm.log).
You can then create a Query (not a Collection since this isn’t a System or User resource) against all instances of SMS_R_Printer. I created one that looks like this:
You can then run this query, and see this resource in the admin console:
Since this data is all stored in SQL and accessible through the provider you can write reports or use other tools to slice and dice this data in interesting ways.
I hope you find this functionality useful!