New WMI-Namspace in sms_def.mof

Author Message
skammerer

  • Total Posts : 8
  • Scores: 0
  • Reward points : 0
  • Joined: 11/25/2009
  • Status: offline
New WMI-Namspace in sms_def.mof Wednesday, November 25, 2009 7:56 AM (permalink)
0
Hello
I'm trying to get the Values of the WMI Class root\WMI\WmiMonitorID into my Inventory over the sms_def.mof

Here is what I have writen at the bottom of my sms_def.mof (still for testing on a Client)

  //---------------------------------------------------------------------------------
 //    BayernOil Vista WmiMonitorID
 //
 //    Version 1.0 Creation  Stephan Kammerer  24.11.2009
 //   
 //
 //---------------------------------------------------------------------------------
 
 // 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("ManufactureName") ] uint16 ManufactureName[];
  [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     ManufactureName[];
  [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;
 };
 


I can check and compile it with mofcomp.exe without errors. If I try to look at the instances in wbemtest.exe of my new root\CIMV2\WmiMonitorIDView I'll get an errormessage: Number: 0x80041001, Facility: WMI, Description: Generic failure

If I read the Values with a VBScript (generated by a tool called WMICodeCreator) I get this Output:
 -----------------------------------
 WmiMonitorIDView instance
 -----------------------------------
 Active: Wahr
 InstanceName: DISPLAY\FUS07B9\4&cadc0ef&0&UID50529024_0
 ManufactureName:
 ProductCodeID: 48,55,66,57,0,0,0,0,0,0,0,0,0,0,0,0
 SerialNumberID: 89,86,49,69,48,48,51,48,52,53,0,0,0,0,0,0
 UserFriendlyName: 80,50,50,87,45,53,0
 UserFriendlyNameLength: 7
 WeekOfManufacture: 19
 YearOfManufacture: 2009
 \\SERVERNAME\USERNAME\redirect\Anwendungsdaten.V2\WMICodeCreator\MyWMIQuery_Script.vbs(34, 1) 
 (null): 0x80041001
 


Obviously the Values from root\WMI\WmiMonitorID are getting transfered to root\CIMV2\WmiMonitorIDView but the last line(\\SERVERNAME\USERNAME\redirect\Anwendungsdaten.V2\WMICodeCreator\MyWMIQuery_Script. vbs(34, 1) (null): 0x80041001) also Contains the 0x80041001 errorcode. I don't want to try it with the real sms_def.mof on the SCCM-Server aslong as this error exists.
Can anyone please help me??
PS. I'm new to SCCM and all that stuff also sorry for bad english (from germany)
<message edited by skammerer on Wednesday, November 25, 2009 8:09 AM>
 
#1
    skammerer

    • Total Posts : 8
    • Scores: 0
    • Reward points : 0
    • Joined: 11/25/2009
    • Status: offline
    RE: New WMI-Namspace in sms_def.mof Friday, November 27, 2009 2:27 AM (permalink)
    0
    Little BUMP

    Please, just some guess or hints. I'll take everything.
    Thanks
     
    #2
      skammerer

      • Total Posts : 8
      • Scores: 0
      • Reward points : 0
      • Joined: 11/25/2009
      • Status: offline
      RE: New WMI-Namspace in sms_def.mof Monday, November 30, 2009 4:42 AM (permalink)
      0
      Problem solved.

      It was just a misspelled word :(
      ManufactureName -> ManufacturerName


      ManufactureName
       
      #3
        skammerer

        • Total Posts : 8
        • Scores: 0
        • Reward points : 0
        • Joined: 11/25/2009
        • Status: offline
        RE: New WMI-Namspace in sms_def.mof Tuesday, December 01, 2009 2:36 AM (permalink)
        0
        First Problem solved, new Problem appears.
        Now that the sms_def.mof works local (mofdef.exe and checking the results with wbemtest) I thought I can upload it to the SCCM Server.
        The Problem now is that the only Value-Set that is inventoried is the one from my TestClient (where i manually run mofcomp). The Values are not getting collected from the other clients. So the sms_def.mof works to look for the values wich are set true in the WmiMonitorIDView Class but doesn't run the provider wich is creating the entry in root\cimv2 :(

        I hope it's not again just a misspelled word...

        Thank's everyone in advance.
        <message edited by skammerer on Tuesday, December 01, 2009 4:24 AM>
         
        #4
          skissinger

          • Total Posts : 4645
          • Scores: 448
          • Reward points : 75260
          • Joined: 9/13/2001
          • Location: Sherry Kissinger
          • Status: offline
          RE: New WMI-Namspace in sms_def.mof Tuesday, December 01, 2009 7:18 AM (permalink)
          0
          I've quite honestly never created my own provider. As a gut-reaction... I'd try putting the provider creation piece in configuration.mof. (the top half). Only the section of namespace root/cimv2/sms and below would go in sms_def.mof
          mofmaster@myitforum.com
          My Blog
          Microsoft MVP - ConfigMgr
           
          #5
            skammerer

            • Total Posts : 8
            • Scores: 0
            • Reward points : 0
            • Joined: 11/25/2009
            • Status: offline
            RE: New WMI-Namspace in sms_def.mof Tuesday, December 01, 2009 10:04 AM (permalink)
            0
            I used this MS-Support article:
            http://support.microsoft.com/kb/314141/en-us/
            It said to put it in sms_def.mof
            Anyway, I will give it a try tomorrow with the configuration.mof

            Thanks
             
            #6
              skissinger

              • Total Posts : 4645
              • Scores: 448
              • Reward points : 75260
              • Joined: 9/13/2001
              • Location: Sherry Kissinger
              • Status: offline
              RE: New WMI-Namspace in sms_def.mof Tuesday, December 01, 2009 12:50 PM (permalink)
              0
              The article you reference is for SMS 2.0.  Hardware Inventory (sms_def.mof, and configuration.mof in Configmgr07) changed from 2.0 to 2003, and then again from 2003 to configMgr07.  If you're on configmgr07, you definitely need to place any of the "data" elements into configuration.mof.  Well... I suppose you could old skool it, and treat it like an SMS2003 mof edit, and ship the snippet to your clients as a mofcomp'd advertisement.  But I'd certainly try moving the data snippet into configuration.mof first.
               
              (This is a lab, right?  Right?  When messing about with new things for hardware inventory, you can easily break your clients' being able to submit a Hinv at all, if you mess up configuration.mof / sms_def.mof in a wierd way).
              mofmaster@myitforum.com
              My Blog
              Microsoft MVP - ConfigMgr
               
              #7
                skammerer

                • Total Posts : 8
                • Scores: 0
                • Reward points : 0
                • Joined: 11/25/2009
                • Status: offline
                RE: New WMI-Namspace in sms_def.mof Wednesday, December 02, 2009 3:22 AM (permalink)
                0
                Lab?
                You're right, it SHOULD be a lab.

                It seems that some people around me like the thrill and therefore they don't give the ressources for a test lab. The only thing i could do were to Backup every step I changed.

                Back to topic. It works!! THANKS!
                I have the first 6 Monitors already inventoried. Just cut the provider part and pasted it into configuration.mof, a moment of fear and then a little bit of ease as new hinvs dropped in.

                You bear the name mofmaster rightly.


                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.
                <message edited by skammerer on Wednesday, December 02, 2009 3:30 AM>
                 
                #8
                  aparrott

                  • Total Posts : 47
                  • Scores: 5
                  • Reward points : 9370
                  • Joined: 12/1/2005
                  • Status: offline
                  Re:New WMI-Namspace in sms_def.mof Wednesday, December 08, 2010 3:25 PM (permalink)
                  0
                  So, I stumbled upon this thread when looking for details on how to inventory the WMIMonitorID class on Vista and above. 
                   
                  I thought I'd update the thread to point out that the configuration.mof additions are complete unneeded with ConfigMgr 2007.  Starting with SMS 2003 you can successfully query namespaces other than CIMV2 using syntax from the example below (note the addition of Namespace() to the SMS_Report 'header').  I think the original confusion started when skammerer found some documentation related to SMS 2.0.  SMS 2.0 was incapable of querying a namespace other than CIMV2 hence the need to use the VIEW provider to 'copy' the class data to the CIMV2 namespace. 
                   
                  ------------------------
                   
                  #pragma namespace("\\\\.\\root\\cimv2\\sms")
                   
                  [ SMS_Report     (True),
                    SMS_Group_Name ("Corp WMIMonitorID"),
                    SMS_Class_ID   ("Corp|WmiMonitorID|1.0"),
                    Namespace("\\\\\\\\.\\\\root\\\\WMI")] 
                   
                  class WmiMonitorID : SMS_Class_Template

                   [SMS_Report (TRUE)]
                   boolean Active;
                   [SMS_Report (TRUE), key]
                   string InstanceName; 
                   [SMS_Report (TRUE)]
                   uint16 ManufacturerName[];
                   [SMS_Report (TRUE)]
                   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;
                  };
                   
                  #9
                    Hermann

                    • Total Posts : 1
                    • Scores: 0
                    • Reward points : 100
                    • Joined: 2/18/2012
                    • Status: offline
                    Re:New WMI-Namspace in sms_def.mof Saturday, February 18, 2012 2:31 AM (permalink)
                    0
                    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
                     
                    #10
                      Online Bookmarks Sharing: Share/Bookmark

                      Jump to:

                      Current active users

                      There are 0 members and 1 guests.

                      Icon Legend and Permission

                      • New Messages
                      • No New Messages
                      • Hot Topic w/ New Messages
                      • Hot Topic w/o New Messages
                      • Locked w/ New Messages
                      • Locked w/o New Messages
                      • Read Message
                      • Post New Thread
                      • Reply to message
                      • Post New Poll
                      • Submit Vote
                      • Post reward post
                      • Delete my own posts
                      • Delete my own threads
                      • Rate post

                      2000-2012 ASPPlayground.NET Forum Version 3.9