Ask a questionAsk a question
 

AnswerSMS Mof editing

  • Monday, November 02, 2009 1:23 AMcjketts Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    This is my first attempt at extending hw inventory for custom registry keys.  We are using SMS 2003. I am trying to determine which machines were incorrectly imaged using a single processor hal image. I have found the key for this at: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000. The values I am interested in are either the hardware id or device description. I have used M. Cochranes’ simple mof extensions for registry keys tool and have come up with the following mof extension:

    #pragma namespace ("\\\\.\\root\\cimv2")

    #pragma deleteclass("HALType", NOFAIL)

    [DYNPROPS]

    Class HALType

    {

    [key] string KeyName;

    Uint32 ConfigFlags;

    Uint32 Legacy;

    Uint32 DeviceReported;

    String Service;

    String HardwareID;

    String CompatibleIDs;

    Uint32 Capabilities;

    String ClassGUID;

    String Class;

    String Driver;

    String Mfg;

    String DeviceDesc;

    };

    [DYNPROPS]

    Instance of HALType

    {

    keyname="SystemCenter.fr";

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|ConfigFlags"),Dynamic,Provider("RegPropProv")] ConfigFlags;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Legacy"),Dynamic,Provider("RegPropProv")] Legacy;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|DeviceReported"),Dynamic,Provider("RegPropProv")] DeviceReported;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Service"),Dynamic,Provider("RegPropProv")] Service;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|HardwareID"),Dynamic,Provider("RegPropProv")] HardwareID;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|CompatibleIDs"),Dynamic,Provider("RegPropProv")] CompatibleIDs;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Capabilities"),Dynamic,Provider("RegPropProv")] Capabilities;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|ClassGUID"),Dynamic,Provider("RegPropProv")] ClassGUID;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Class"),Dynamic,Provider("RegPropProv")] Class;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Driver"),Dynamic,Provider("RegPropProv")] Driver;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Mfg"),Dynamic,Provider("RegPropProv")] Mfg;

    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|DeviceDesc"),Dynamic,Provider("RegPropProv")] DeviceDesc;

    };

    #pragma namespace ("\\\\.\\root\\cimv2\\SMS")

    #pragma deleteclass("HALType", NOFAIL)

    [SMS_Report(TRUE),SMS_Group_Name("HALType"),SMS_Class_ID("Custom|HALType|1.0")]

    Class HALType: SMS_Class_Template

    {

    [SMS_Report(false),key] string KeyName;

    [SMS_Report(false)] Uint32 ConfigFlags;

    [SMS_Report(false)] Uint32 Legacy;

    [SMS_Report(false)] Uint32 DeviceReported;

    [SMS_Report(false)] String Service;

    [SMS_Report(true)] String HardwareID;

    [SMS_Report(false)] String CompatibleIDs;

    [SMS_Report(false)] Uint32 Capabilities;

    [SMS_Report(false)] String ClassGUID;

    [SMS_Report(false)] String Class;

    [SMS_Report(false)] String Driver;

    [SMS_Report(false)] String Mfg;

    [SMS_Report(TRUE)] String DeviceDesc;

    };

     

    After I run mofcomp, I receive the error : test.mof (15): error SYNTAX 0X8004400c: Expected property or method name.

    I know I’m missing something, and am thinking maybe this key can’t be used in this way?

     Any help would be appreciated.

Answers

  • Monday, November 02, 2009 10:19 PMSherry KissingerMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Mildly tricky.  You can't have an attribute with a label of "class"
    Change this:
    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Class"),Dynamic,Provider("RegPropProv")] Class;

    To something like... oh... this:
    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Class"),Dynamic,Provider("RegPropProv")] HALClass;

    It doesn't really matter, except that you not call it exactly the name of "class".

    Remember to change it above & below, to match, i.e., uint32 class;
    to uint32 HALClass;

    and the reporting section of [SMS_Report(false)] String Class;
    to [SMS_Report(false)] String HALClass;

    Alternatively, since you apparently don't need that attribute at all anyway, feel free to delete all three "class" lines.  Won't affect a thing if you simply remove all 3 references.

    Standardize. Simplify. Automate.
    • Marked As Answer bycjketts Sunday, November 08, 2009 3:18 PM
    •  

All Replies

  • Monday, November 02, 2009 1:29 PMGarth JonesMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

     

    [SMS_Report(false),key] string KeyName;


    I have only quickly looked at this edit but, I see that this line must be set to True.
    http://www.enhansoft.com/
  • Monday, November 02, 2009 10:19 PMSherry KissingerMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Mildly tricky.  You can't have an attribute with a label of "class"
    Change this:
    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Class"),Dynamic,Provider("RegPropProv")] Class;

    To something like... oh... this:
    [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\Root\\ACPI_HAL\\0000|Class"),Dynamic,Provider("RegPropProv")] HALClass;

    It doesn't really matter, except that you not call it exactly the name of "class".

    Remember to change it above & below, to match, i.e., uint32 class;
    to uint32 HALClass;

    and the reporting section of [SMS_Report(false)] String Class;
    to [SMS_Report(false)] String HALClass;

    Alternatively, since you apparently don't need that attribute at all anyway, feel free to delete all three "class" lines.  Won't affect a thing if you simply remove all 3 references.

    Standardize. Simplify. Automate.
    • Marked As Answer bycjketts Sunday, November 08, 2009 3:18 PM
    •  
  • Sunday, November 08, 2009 3:23 PMcjketts Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thank-you for your response. I deleted the 3 class lines as suggested and have received my desired results.