Skip to main content
IWbemRefresher::Refresh method

The IWbemRefresher::Refresh method updates all refreshable objects, enumerators, and nested refreshers. The WMI Refresher calls this function in response to a client request to Refresh.


HRESULT Refresh(
  [in] long lFlags


lFlags [in]

Bitmask of flags that modify the behavior of this method.

If WBEM_FLAG_REFRESH_AUTO_RECONNECT is specified and if the connection is broken, the refresher attempts to reconnect to the provider automatically. This is the default behavior for this method.

If you do not want the refresher to attempt to reconnect to the provider, specify WBEM_FLAG_REFRESH_NO_AUTO_RECONNECT.

Return value

This method returns an HRESULT indicating the status of the method call. The following list lists the value contained within an HRESULT.


The method was successful.


A specified parameter is not valid.


The refresher is busy with another operation.


The provider failed internally, even though the operation was valid.


When refreshing enumerators and objects, providers should take as little time as possible. Using the IWbemObjectAccess methods and caching property handles for reuse can dramatically improve performance. When updating enumerators, a provider can either remove and re-instantiate all objects, or simply remove and add the changed instances. It is up to you to choose the best approach. In either case, caching instances can improve performance.

The provider should only access the objects and enumerators in a refresher in response to a call to IWbemRefresher::Refresh. It would, however, be perfectly valid to have a background thread polling for data with which to fill these objects, to prepare for when Refresh is called.


The following code example describes how to implement Refresh.

HRESULT CMyHiPerfProviderRefresher::Refresh(
/* [in] */long lFlags
  // Run through all the objects and update their
  // data.

  // Now run through the enumerators.
  // Empty the enumerator and refill it.

  return WBEM_S_NO_ERROR;


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008


Wbemcli.h (include Wbemidl.h)



See also

Developing a WMI Provider
Writing an Instance Provider
Making an Instance Provider into a High-Performance Provider
Performance Counter Provider