IoanPopovici
2/8/2016 - 1:13 PM

HWI EXT SQL Classes

HWI EXT SQL Classes for SQL Server Product Reporting

//==========================================================
//——————————————————| SQL extension start |—————————————————
//==========================================================

//-- Set default WMI namespace
#Pragma NameSpace ("\\\\.\\ROOT\\cimv2")

//——————————————— // SQL 2017 Class //———————————————

//-- Create custom WMI class
//-  Class qualifiers
[
    Description("The SQL_2017 class contains information about the SQL 2017 service. You can use this information for SQL version reporting."): ToInstance,
    UNION,
    ViewSources {
        "SELECT IsReadOnly, PropertyIndex, PropertyName, PropertyNumValue, PropertyStrValue, PropertyValueType, ServiceName, SqlServiceType FROM SqlServiceAdvancedProperty"
    },
    ViewSpaces {
        "\\\\.\\ROOT\\Microsoft\\SqlServer\\ComputerManagement14"
    },
    Dynamic,
    Provider ("MS_VIEW_INSTANCE_PROVIDER")
]
//-  Class properties
Class SQL_2017
{
    [PropertySources{"IsReadOnly"}         ] Boolean IsReadOnly;
    [PropertySources{"PropertyIndex"},  KEY] UInt32  PropertyIndex;
    [PropertySources{"PropertyName"},   KEY] String  PropertyName;
    [PropertySources{"PropertyNumValue"}   ] UInt32  PropertyNumValue;
    [PropertySources{"PropertyStrValue"}   ] String  PropertyStrValue;
    [PropertySources{"PropertyValueType"}  ] UInt32  PropertyValueType;
    [PropertySources{"ServiceName"},    KEY] String  ServiceName;
    [PropertySources{"SqlServiceType"}, KEY] UInt32  SqlServiceType;
};

//——————————————— // SQL 2016 Class //———————————————

//-- Create custom WMI class
//-  Class qualifiers
[
    Description("The SQL_2016 class contains information about the SQL 2016 service. You can use this information for SQL version reporting."): ToInstance,
    UNION,
    ViewSources {
        "SELECT IsReadOnly, PropertyIndex, PropertyName, PropertyNumValue, PropertyStrValue, PropertyValueType, ServiceName, SqlServiceType FROM SqlServiceAdvancedProperty"
    },
    ViewSpaces {
        "\\\\.\\ROOT\\Microsoft\\SqlServer\\ComputerManagement13"
    },
    Dynamic,
    Provider ("MS_VIEW_INSTANCE_PROVIDER")
]
//-  Class properties
Class SQL_2016
{
    [PropertySources{"IsReadOnly"}         ] Boolean IsReadOnly;
    [PropertySources{"PropertyIndex"},  KEY] UInt32  PropertyIndex;
    [PropertySources{"PropertyName"},   KEY] String  PropertyName;
    [PropertySources{"PropertyNumValue"}   ] UInt32  PropertyNumValue;
    [PropertySources{"PropertyStrValue"}   ] String  PropertyStrValue;
    [PropertySources{"PropertyValueType"}  ] UInt32  PropertyValueType;
    [PropertySources{"ServiceName"},    KEY] String  ServiceName;
    [PropertySources{"SqlServiceType"}, KEY] UInt32  SqlServiceType;
};

//——————————————— // SQL 2014 Class //———————————————

//-- Create custom WMI class
//-  Class qualifiers
[
    Description("The SQL_2014 class contains information about the SQL 2014 service. You can use this information for SQL version reporting."): ToInstance,
    UNION,
    ViewSources {
        "SELECT IsReadOnly, PropertyIndex, PropertyName, PropertyNumValue, PropertyStrValue, PropertyValueType, ServiceName, SqlServiceType FROM SqlServiceAdvancedProperty"
    },
    ViewSpaces {
        "\\\\.\\ROOT\\Microsoft\\SqlServer\\ComputerManagement12"
    },
    Dynamic,
    Provider ("MS_VIEW_INSTANCE_PROVIDER")
]
//-- Class properties
Class SQL_2014
{
    [PropertySources{"IsReadOnly"}         ] Boolean IsReadOnly;
    [PropertySources{"PropertyIndex"},  KEY] UInt32  PropertyIndex;
    [PropertySources{"PropertyName"},   KEY] String  PropertyName;
    [PropertySources{"PropertyNumValue"}   ] UInt32  PropertyNumValue;
    [PropertySources{"PropertyStrValue"}   ] String  PropertyStrValue;
    [PropertySources{"PropertyValueType"}  ] UInt32  PropertyValueType;
    [PropertySources{"ServiceName"},    KEY] String  ServiceName;
    [PropertySources{"SqlServiceType"}, KEY] UInt32  SqlServiceType;
};

//——————————————— // SQL 2012 Class //———————————————

//-- Create custom WMI class
//-  Class qualifiers
[
    Description("The SQL_2012 class contains information about the SQL 2012 service. You can use this information for SQL version reporting."): ToInstance,
    UNION,
    ViewSources {
        "SELECT IsReadOnly, PropertyIndex, PropertyName, PropertyNumValue, PropertyStrValue, PropertyValueType, ServiceName, SqlServiceType FROM SqlServiceAdvancedProperty"
    },
    ViewSpaces {
        "\\\\.\\ROOT\\Microsoft\\SqlServer\\ComputerManagement11"
    },
    Dynamic,
    Provider ("MS_VIEW_INSTANCE_PROVIDER")
]
//-  Class properties
Class SQL_2012
{
    [PropertySources{"IsReadOnly"}         ] Boolean IsReadOnly;
    [PropertySources{"PropertyIndex"},  KEY] UInt32  PropertyIndex;
    [PropertySources{"PropertyName"},   KEY] String  PropertyName;
    [PropertySources{"PropertyNumValue"}   ] UInt32  PropertyNumValue;
    [PropertySources{"PropertyStrValue"}   ] String  PropertyStrValue;
    [PropertySources{"PropertyValueType"}  ] UInt32  PropertyValueType;
    [PropertySources{"ServiceName"},    KEY] String  ServiceName;
    [PropertySources{"SqlServiceType"}, KEY] UInt32  SqlServiceType;
};

//——————————————— // SQL 2008 Class //———————————————

//-- Create custom WMI class
//-  Class Qualifiers
[
    Description("The SQL_2008 class contains information about the SQL 2008 service. You can use this information for SQL version reporting."): ToInstance,
    UNION,
    ViewSources {
        "SELECT IsReadOnly, PropertyIndex, PropertyName, PropertyNumValue, PropertyStrValue, PropertyValueType, ServiceName, SqlServiceType FROM SqlServiceAdvancedProperty"
    },
    ViewSpaces {
        "\\\\.\\ROOT\\Microsoft\\SqlServer\\ComputerManagement10"
    },
    Dynamic,
    Provider ("MS_VIEW_INSTANCE_PROVIDER")
]
//-  Class properties
Class SQL_2008
{
    [PropertySources{"IsReadOnly"}         ] Boolean IsReadOnly;
    [PropertySources{"PropertyIndex"},  KEY] UInt32  PropertyIndex;
    [PropertySources{"PropertyName"},   KEY] String  PropertyName;
    [PropertySources{"PropertyNumValue"}   ] UInt32  PropertyNumValue;
    [PropertySources{"PropertyStrValue"}   ] String  PropertyStrValue;
    [PropertySources{"PropertyValueType"}  ] UInt32  PropertyValueType;
    [PropertySources{"ServiceName"},    KEY] String  ServiceName;
    [PropertySources{"SqlServiceType"}, KEY] UInt32  SqlServiceType;
};

//——————————————— // SQL 2000/2005 //———————————————

//-- Create custom WMI class
//-  Class Qualifiers
[
    Description("The SQL_2000_And_2005 class contains information about the SQL 2000 and 2005 service. You can use this information for SQL version reporting."): ToInstance,
    UNION,
    ViewSources {
        "SELECT IsReadOnly, PropertyIndex, PropertyName, PropertyNumValue, PropertyStrValue, PropertyValueType, ServiceName, SqlServiceType FROM SqlServiceAdvancedProperty"
    },
    ViewSpaces {
        "\\\\.\\ROOT\\Microsoft\\SqlServer\\ComputerManagement"
    },
    Dynamic,
    Provider ("MS_VIEW_INSTANCE_PROVIDER")
]
//-  Class properties
Class SQL_2000_And_2005
{
    [PropertySources{"IsReadOnly"}         ] Boolean IsReadOnly;
    [PropertySources{"PropertyIndex"},  KEY] UInt32  PropertyIndex;
    [PropertySources{"PropertyName"},   KEY] String  PropertyName;
    [PropertySources{"PropertyNumValue"}   ] UInt32  PropertyNumValue;
    [PropertySources{"PropertyStrValue"}   ] String  PropertyStrValue;
    [PropertySources{"PropertyValueType"}  ] UInt32  PropertyValueType;
    [PropertySources{"ServiceName"},    KEY] String  ServiceName;
    [PropertySources{"SqlServiceType"}, KEY] UInt32  SqlServiceType;
};

//==========================================================
//———————————————————| SQL extension end |——————————————————
//==========================================================