def _set_wmi_setting(wmi_class_name, setting, value, server):
 with salt.utils.winapi.Com():
  try:
   connection = wmi.WMI(namespace=_WMI_NAMESPACE)
   wmi_class = getattr(connection, wmi_class_name)
   objs = wmi_class(Name=server)[0]
  except wmi.x_wmi as error:
   _LOG.error('Encountered WMI error: %s', error.com_error)
  except (AttributeError, IndexError) as error:
   _LOG.error('Error getting %s: %s', wmi_class_name, error)
  try:
   setattr(objs, setting, value)
   return True
  except wmi.x_wmi as error:
   _LOG.error('Encountered WMI error: %s', error.com_error)
  except AttributeError as error:
   _LOG.error('Error setting %s: %s', setting, error)
 return False

def _set_wmi_setting ( wmi_class_name , setting , value , server ) : with salt . utils . winapi . Com ( ) : try : connection = wmi . WMI ( namespace = _WMI_NAMESPACE ) wmi_class = getattr ( connection , wmi_class_name ) objs = wmi_class ( Name = server ) [ 0 ] except wmi . x_wmi as error : _LOG . error ( 'Encountered WMI error: %s' , error . com_error ) except ( AttributeError , IndexError ) as error : _LOG . error ( 'Error getting %s: %s' , wmi_class_name , error ) try : setattr ( objs , setting , value ) return True except wmi . x_wmi as error : _LOG . error ( 'Encountered WMI error: %s' , error . com_error ) except AttributeError as error : _LOG . error ( 'Error setting %s: %s' , setting , error ) return False
set the value of the setting for the provided class .