Answered by:
New WMI-Namespace in SMS_DEF.mof

Question
-
Hello,
I try to inventory information about Monitors from the new WMI-Class \root\WMI\WmiMonitorID
This is what i added to my sms_def.mof:
// Provider für \\root\\WMI Namespace #pragma namespace("\\\\.\\Root\\CIMV2") instance of __Win32Provider as $DataProv { Name = "MS_VIEW_INSTANCE_PROVIDER"; ClsId = "{AA70DDF4-E11C-11D1-ABB0-00C04FD9159E}"; ImpersonationLevel = 1; PerUserInitialization = "True"; }; instance of __InstanceProviderRegistration { Provider = $DataProv; SupportsPut = True; SupportsGet = True; SupportsDelete = True; SupportsEnumeration = True; QuerySupportLevels = {"WQL:UnarySelect"}; }; [union, ViewSources{"Select * from WmiMonitorID"}, ViewSpaces{"\\\\.\\root\\WMI"}, Dynamic : ToInstance, provider("MS_VIEW_INSTANCE_PROVIDER")] class WmiMonitorIDView { [PropertySources("Active") ] boolean Active; [PropertySources("InstanceName"), key ] string InstanceName; [PropertySources("ManufacturerName") ] uint16 ManufacturerName[]; [PropertySources("ProductCodeID") ] uint16 ProductCodeID[]; [PropertySources("SerialNumberID") ] uint16 SerialNumberID[]; [PropertySources("UserFriendlyName") ] uint16 UserFriendlyName[]; [PropertySources("UserFriendlyNameLength") ] uint16 UserFriendlyNameLength; [PropertySources("WeekOfManufacture") ] uint8 WeekOfManufacture; [PropertySources("YearOfManufacture") ] uint16 YearOfManufacture; }; // Klasse für WmiMonitorIDView Instanz #pragma namespace("\\\\.\\root\\cimv2\\sms") [ SMS_Report (True), SMS_Group_Name ("WmiMonitorIDView"), SMS_Class_ID ("BAYERNOIL|WmiMonitorID|1.0") ] class WmiMonitorIDView : SMS_Class_Template { [SMS_Report (TRUE) ] boolean Active; [SMS_Report (TRUE), key] string InstanceName; [SMS_Report (TRUE) ] uint16 ManufacturerName[]; [SMS_Report (FALSE) ] uint16 ProductCodeID[]; [SMS_Report (TRUE) ] uint16 SerialNumberID[]; [SMS_Report (TRUE) ] uint16 UserFriendlyName[]; [SMS_Report (FALSE) ] uint16 UserFriendlyNameLength; [SMS_Report (TRUE) ] uint8 WeekOfManufacture; [SMS_Report (TRUE) ] uint16 YearOfManufacture; };
The values from the client machine on wich i tested my new MOF-File (manual mofcomp.exe and check the entries with wbemtest.exe) are collected on the SCCM Server and I can query them with CfgMgr.
It seems to me that the SCCM-Server is checking for the new WmiMonitorIDView Class from the new sms_def.mof but it is not creating the new entries into root\CMIV2 through the provider i defined. Thats why just the Test-Client is inventoried because it already holds the new data because of the manual run of mofcomp before.
My question is: Why is the SCCM-Server not running the Provider wich is defined at the bottom of sms_def.mof on the other clients. It worked manual on the client, why doesn't it over the server?Tuesday, December 1, 2009 9:49 AM
Answers
-
wow, this looks awfully familiar... Have you tried putting the data piece in configuration.mof yet? and leaving just the reporting piece in sms_def.mof?
http://www.myitforum.com/forums/New_WMI-Namspace_in_sms_def%25mof/m_211074/tm.htm
Standardize. Simplify. Automate.- Marked as answer by THORNE Steve Wednesday, December 2, 2009 8:25 AM
Tuesday, December 1, 2009 8:33 PM
All replies
-
wow, this looks awfully familiar... Have you tried putting the data piece in configuration.mof yet? and leaving just the reporting piece in sms_def.mof?
http://www.myitforum.com/forums/New_WMI-Namspace_in_sms_def%25mof/m_211074/tm.htm
Standardize. Simplify. Automate.- Marked as answer by THORNE Steve Wednesday, December 2, 2009 8:25 AM
Tuesday, December 1, 2009 8:33 PM -
Thanks! It worked.
For everybody else, see more at:
http://www.myitforum.com/forums/New_WMI-Namspace_in_sms_def%25mof/m_211074/tm.htm
P.S. For anybody who wants to use this. This works just with Win2008/Vista and above. The root/Wmi/WmiMonitorId entry doesn't exist in previous versions.
Wednesday, December 2, 2009 8:26 AM -
I also have got this to work (thanks all) however the info is in hex and doesn't really seem useful for anything?
e.g. the serial number of CN123456 comes through (via SerialNumberID) as 70, 57, 48, 50, 78, 57, 55, 50, 48, 75, 65, 76, 0, 0, 0, 0
Do you convert this somehow?
Thanks in advance
Steve
Wednesday, June 23, 2010 3:40 AM -
To convert SerialNumberID and other ASCII-Code Array into String, you need a quite complex recursive Query (WITH-Clause) in your report:
[ WITH <common_table_expression> [ ,...n ] ]
<common_table_expression>::=
expression_name [ (column_name [ ,...n ] ) ]
AS
(CTE_query_definition)
You don't need to deploy any package on clients.SQL-Query:
;WITH T (myManNameString, myManNameStrings, myManSerialString, myManSerialStrings, myManUFNString, myManUFNStrings, InstanceName, ResourceID, RevisionID, WeekOfManufacture, YearOfManufacture) AS ( SELECT CAST(CHAR(CASE WHEN CHARINDEX(', ', Monitor1.ManufacturerName0) > 0 THEN LTRIM(SUBSTRING(Monitor1.ManufacturerName0, 1, CHARINDEX(', ', Monitor1.ManufacturerName0) - 1)) ELSE Monitor1.ManufacturerName0 END) AS Varchar(max)) AS oneManName, LTRIM(SUBSTRING(Monitor1.ManufacturerName0, CHARINDEX(', ', Monitor1.ManufacturerName0) + 1, LEN(Monitor1.ManufacturerName0) - CHARINDEX(', ', Monitor1.ManufacturerName0))) AS myManNameStrings, CAST(CHAR(CASE WHEN CHARINDEX(', ', Monitor1.SerialNumberID0) > 0 THEN LTRIM(SUBSTRING(Monitor1.SerialNumberID0, 1, CHARINDEX(', ', Monitor1.SerialNumberID0) - 1)) ELSE Monitor1.SerialNumberID0 END) AS Varchar(max)) AS oneManSerial, LTRIM(SUBSTRING(Monitor1.SerialNumberID0, CHARINDEX(', ', Monitor1.SerialNumberID0) + 1, LEN(Monitor1.SerialNumberID0) - CHARINDEX(', ', Monitor1.SerialNumberID0))) AS myManSerialStrings, CAST(CHAR(CASE WHEN CHARINDEX(', ', Monitor1.UserFriendlyName0) > 0 THEN LTRIM(SUBSTRING(Monitor1.UserFriendlyName0, 1, CHARINDEX(', ', Monitor1.UserFriendlyName0) - 1)) ELSE Monitor1.UserFriendlyName0 END) AS Varchar(max)) AS oneManUFN, LTRIM(SUBSTRING(Monitor1.UserFriendlyName0, CHARINDEX(', ', Monitor1.UserFriendlyName0) + 1, LEN(Monitor1.UserFriendlyName0) - CHARINDEX(', ', Monitor1.UserFriendlyName0))) AS myManUFNStrings, InstanceName0, ResourceID, RevisionID, WeekOfManufacture0, YearOfManufacture0 FROM v_GS_WmiMonitorIDView0 AS Monitor1 UNION ALL SELECT myManNameString + CHAR(CASE WHEN CHARINDEX(', ', myManNameStrings) > 0 THEN LTRIM(SUBSTRING(myManNameStrings, 1, CHARINDEX(', ', myManNameStrings) - 1)) ELSE myManNameStrings END), CASE WHEN CHARINDEX(', ', myManNameStrings) > 0 THEN LTRIM(SUBSTRING(myManNameStrings, CHARINDEX(', ', myManNameStrings) + 1, LEN(myManNameStrings) - CHARINDEX(', ', myManNameStrings))) ELSE NULL END, myManSerialString + CHAR(CASE WHEN CHARINDEX(', ', myManSerialStrings) > 0 THEN LTRIM(SUBSTRING(myManSerialStrings, 1, CHARINDEX(', ', myManSerialStrings) - 1)) ELSE myManSerialStrings END), CASE WHEN CHARINDEX(', ', myManSerialStrings) > 0 THEN LTRIM(SUBSTRING(myManSerialStrings, CHARINDEX(', ', myManSerialStrings) + 1, LEN(myManSerialStrings) - CHARINDEX(', ', myManSerialStrings))) ELSE NULL END, myManUFNString + CHAR(CASE WHEN CHARINDEX(', ', myManUFNStrings) > 0 THEN LTRIM(SUBSTRING(myManUFNStrings, 1, CHARINDEX(', ', myManUFNStrings) - 1)) ELSE myManUFNStrings END), CASE WHEN CHARINDEX(', ', myManUFNStrings) > 0 THEN LTRIM(SUBSTRING(myManUFNStrings, CHARINDEX(', ', myManUFNStrings) + 1, LEN(myManUFNStrings) - CHARINDEX(', ', myManUFNStrings))) ELSE NULL END, Monitor2.InstanceName0, Monitor2.ResourceID, Monitor2.RevisionID, Monitor2.WeekOfManufacture0, Monitor2.YearOfManufacture0 FROM v_GS_WmiMonitorIDView0 AS Monitor2 INNER JOIN T ON T.InstanceName = Monitor2.InstanceName0 AND T.RevisionID = Monitor2.RevisionID AND T.ResourceID = Monitor2.ResourceID WHERE myManNameStrings IS NOT NULL ) SELECT SYS.Netbios_Name0, v_gs_system_enclosure.serialnumber0 AS "Computer Serial Number", MAX(myManNameString) AS 'Monitor Manufacturer Name', MAX(myManSerialString) AS 'Monitor Serial Number', CASE WHEN MAX(myManUFNString) = '0' THEN 'Integrated Monitor' WHEN MAX(myManUFNString) is null THEN 'Integrated Monitor' ELSE MAX(myManUFNString) END AS 'Monitor User Friendly Name', MAX(T.WeekOfManufacture) AS 'Monitor Week Of Manufacture', MAX(T.YearOfManufacture) AS 'Monitor Year Of Manufacture' FROM T INNER JOIN v_R_System as SYS ON T.ResourceID = SYS.ResourceID INNER JOIN v_gs_system_enclosure ON v_gs_system_enclosure.ResourceID = SYS.ResourceID GROUP BY T.InstanceName, T.RevisionID, SYS.Netbios_Name0, v_gs_system_enclosure.serialnumber0 ORDER BY SYS.Netbios_Name0
- Proposed as answer by Martin Schneeberger Tuesday, July 3, 2012 10:29 AM
Saturday, February 18, 2012 7:21 AM -
Is there an updated URL? The one below throws an error.
http://www.myitforum.com/forums/New_WMI-Namspace_in_sms_def%25mof/m_211074/tm.htm
Found CM12 Verion of the code:
http://blogs.technet.com/b/kmongwa/archive/2012/09/07/reporting-monitor-information-with-configuration-manager.aspx
- Edited by jkpartin Tuesday, January 13, 2015 6:29 PM
Tuesday, January 13, 2015 6:18 PM