locked
Collect printer related registry hive from Windows 7 machines RRS feed

  • Question

  • Hi folks,

    in order to collect local printer information without the need to enable printing classes in the sms_def.mof and go through all that script and tools stuff, we had an easy idea just to collect the corresponding registry hive and some subkeys from here:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Drivers\Version-3

    So we modified both the SMS_DEF.mof:

    #pragma namespace ("\\\\.\\root\\cimv2\\sms")
    [ SMS_Report     (TRUE),
      SMS_Group_Name ("Printers"),
      SMS_Class_ID   ("OURS|LocalPrintersV3|1.0") ]
    class LocalPrintersV3 : SMS_Class_Template
    {
        [SMS_Report (TRUE), key]
            string PrinterName;
        [SMS_Report (TRUE)]
            string Driver;
        [SMS_Report (TRUE)]
            string DriverDate;
        [SMS_Report (TRUE)]
            string DriverVersion;
        [SMS_Report (TRUE)]
            string Manufacturer;
    };

    ...and also Configuration.mof:

    #pragma namespace ("\\\\.\\root\\cimv2")
    #pragma deleteclass("LocalPrintersV3",NOFAIL)
    [ dynamic, 
      provider("RegProv"),
      ClassContext("local|HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Drivers\\Version-3") ]
    class LocalPrintersV3
    {
        [key]      
            string    PrinterName;
        [PropertyContext("Installed")]
            string    Driver;
            string    DriverDate;
            string    DriverVersion;
            string    Manufacturer;
    };

    I wouldn't have believed that might work if we hadn't done the same thing for other registry hives sucessfully already, so kind of 'looping' through the hive and get the subhives, related keys and values.

    From the InvetoryAgent.log at the target (test) machine I can see that the new class is picked up for inventory without any errors, and at the CEN I can see from the dataldr.log that the set for the test machine is being picked up as well.

    But as you can already imagine, for some reason the collected data never shows up in the resource explorer :-/

    Any ideas?



    • Edited by Tom1969 Tuesday, April 23, 2013 9:42 AM
    Tuesday, April 23, 2013 9:39 AM

Answers

  • You are missing "stuff" (propertycontext stuff) in the configuration.mof section.  I used regkeytomof to build the snippets, then edited out the noise (the regkeys you didn't want) and ended up with this.  threw it in my cm12 lab (I don't have a cm07 home lab anymore) and it worked.


    //  This Section for SMS_Def.mof, or to import if CM12
    // RegKeyToMOF by Mark Cochrane (thanks to Skissinger, Steverac, Jonas Hettich & Kent Agerlund)
    // this section tells the inventory agent what to report to the server
    // 4/23/2013 5:50:15 AM

    #pragma namespace ("\\\\.\\root\\cimv2\\SMS")
    #pragma deleteclass("LocalPrintersv3_64", NOFAIL)
    [SMS_Report(TRUE),SMS_Group_Name("LocalPrintersv3_64"),SMS_Class_ID("LocalPrintersv3_64")]
    Class LocalPrintersv3_64: SMS_Class_Template
    {
    [SMS_Report(TRUE),key] string KeyName;
    [SMS_Report(TRUE)] String Driver;
    [SMS_Report(TRUE)] String Manufacturer;
    [SMS_Report(TRUE)] String DriverDate;
    [SMS_Report(TRUE)] String DriverVersion;
    };


    //  This Section for configuration.mof

    // RegKeyToMOF by Mark Cochrane (thanks to Skissinger, Steverac, Jonas Hettich & Kent Agerlund)
    // this section tells the inventory agent what to collect
    // 4/23/2013 5:50:15 AM

    #pragma namespace ("\\\\.\\root\\cimv2")
    #pragma deleteclass("LocalPrintersv3_64", NOFAIL)
    [dynamic, provider("RegProv"), ClassContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Drivers\\Version-3")]
    Class LocalPrintersv3_64
    {
    [key] string KeyName;
    [PropertyContext("Driver")] String Driver;
    [PropertyContext("Manufacturer")] String Manufacturer;
    [PropertyContext("DriverDate")] String DriverDate;
    [PropertyContext("DriverVersion")] String DriverVersion;
    };

     


    Standardize. Simplify. Automate.

    • Marked as answer by Tom1969 Tuesday, April 23, 2013 1:49 PM
    Tuesday, April 23, 2013 11:42 AM

All replies

  • You are missing "stuff" (propertycontext stuff) in the configuration.mof section.  I used regkeytomof to build the snippets, then edited out the noise (the regkeys you didn't want) and ended up with this.  threw it in my cm12 lab (I don't have a cm07 home lab anymore) and it worked.


    //  This Section for SMS_Def.mof, or to import if CM12
    // RegKeyToMOF by Mark Cochrane (thanks to Skissinger, Steverac, Jonas Hettich & Kent Agerlund)
    // this section tells the inventory agent what to report to the server
    // 4/23/2013 5:50:15 AM

    #pragma namespace ("\\\\.\\root\\cimv2\\SMS")
    #pragma deleteclass("LocalPrintersv3_64", NOFAIL)
    [SMS_Report(TRUE),SMS_Group_Name("LocalPrintersv3_64"),SMS_Class_ID("LocalPrintersv3_64")]
    Class LocalPrintersv3_64: SMS_Class_Template
    {
    [SMS_Report(TRUE),key] string KeyName;
    [SMS_Report(TRUE)] String Driver;
    [SMS_Report(TRUE)] String Manufacturer;
    [SMS_Report(TRUE)] String DriverDate;
    [SMS_Report(TRUE)] String DriverVersion;
    };


    //  This Section for configuration.mof

    // RegKeyToMOF by Mark Cochrane (thanks to Skissinger, Steverac, Jonas Hettich & Kent Agerlund)
    // this section tells the inventory agent what to collect
    // 4/23/2013 5:50:15 AM

    #pragma namespace ("\\\\.\\root\\cimv2")
    #pragma deleteclass("LocalPrintersv3_64", NOFAIL)
    [dynamic, provider("RegProv"), ClassContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Print\\Environments\\Windows x64\\Drivers\\Version-3")]
    Class LocalPrintersv3_64
    {
    [key] string KeyName;
    [PropertyContext("Driver")] String Driver;
    [PropertyContext("Manufacturer")] String Manufacturer;
    [PropertyContext("DriverDate")] String DriverDate;
    [PropertyContext("DriverVersion")] String DriverVersion;
    };

     


    Standardize. Simplify. Automate.

    • Marked as answer by Tom1969 Tuesday, April 23, 2013 1:49 PM
    Tuesday, April 23, 2013 11:42 AM
  • Hi Sherry,

    wow that was quick, and even better it worked :-)

    Thanks a lot for giving a hand on that.

    Greetings,
    Tom

    Tuesday, April 23, 2013 1:50 PM