def _get_wmi_setting(wmi_class_name, setting, server):
    '''
    Get the value of the setting for the provided class.
    '''
    with salt.utils.winapi.Com():
        try:
            connection = wmi.WMI(namespace=_WMI_NAMESPACE)
            wmi_class = getattr(connection, wmi_class_name)

            objs = wmi_class([setting], Name=server)[0]
            ret = getattr(objs, setting)
        except wmi.x_wmi as error:
            _LOG.error('Encountered WMI error: %s', error.com_error)
        except (AttributeError, __HOLE__) as error:
            _LOG.error('Error getting %s: %s', wmi_class_name, error)
    return ret
dataset/ETHPy150Open saltstack/salt/salt/modules/win_smtp_server.py/_get_wmi_setting