Share This Post

The ConfigMgr SMSPROV.LOG is a programmer’s best friend

When I am programming widgets against ConfigMgr I have found the smsprov.log to be an invaluable tool. Sure, the SDK is great for figuring out class definitions, methods/properties available, etc., but when I get stuck trying to figure out how these objects work together or what WMI class I need to query nothing gets me the answer faster than the smsprov.log…

Here is the definition of the smsprov.log from the very helpful TechNet article:

“List of Log Files in Configuration Manager 2007” – link

image

Typically my programming widgets for ConfigMgr are trying to take some native console functionality and wrap it into an automation script.  The smsprov.log records the commands sent thru the WMI provider, which include anything done inside the ConfigMgr console.

The best way I’ve found to use smsprov.log for programming is to perform the action I am seeking to replicate in the console and then read the log entries to see the WMI queries (and SQL queries!) that were used by ConfigMgr to complete the action I initiated.

Example:

I was modifying some PowerShell scripts that handle our ConfigMgr patch deployments and deployment packages (maybe a future blog topic) and I got stuck trying to figure out the best way to get the ContentID for an update I wanted to remove from a package.

I opened the smsprov.log and then using the console I deleted an update from a deployment package.  After sifting thru the smsprov.log entries (it’s a dense log) I found what I was looking for:

Execute WQL =select pc.ContentID from SMS_PackageToContent as pc join SMS_CIToContent as cc on cc.ContentID = pc.ContentID where pc.PackageID = ‘XXXXXXXX’ and cc.CI_ID in ( XXXXX )

 

Maybe if I had memorized the SDK section, “Software Distribution Server WMI Classes”, I might have already known about this WMI class or maybe I might have tried one of the other similar classes like “SMS_CIToContent”, but watching the smsprov.log led me straight to the answer; plus, it’s a WQL query I can copy-n-paste straight into my code…

Share This Post

Leave a Reply