Objeto SWbemRefreshableItem

El objeto SWbemRefreshableItem representa un único elemento en un objeto SWbemRefresher. Un objeto SWbemRefreshableItem se obtiene a través de los métodos Add y AddEnum de SWbemRefresher. Este objeto no se puede crear mediante la llamada CreateObject de VBScript.

Miembros

El objeto SWbemRefreshableItem tiene estos tipos de miembros:

Métodos

El objeto SWbemRefreshableItem tiene estos métodos.

Método Descripción
Remove Quita el objeto SWbemRefreshableItem del objeto primario SWbemRefresher.

Propiedades

El objeto SWbemRefreshableItem tiene estas propiedades.

Propiedad Tipo de acceso Descripción
Index
Lectura/escritura
Índice del elemento en su objeto SWbemRefresher primario.
IsSet
Lectura/escritura
Indica si el objeto SWbemRefreshableItem representa un único objeto o un conjunto de objetos.
Object
Lectura/escritura
Representa un único objeto SWbemObject que se actualiza.
ObjectSet
Lectura/escritura
Representa el conjunto de objetos que se va a actualizar.
Refresher
Solo lectura
Representa el objeto primario SWbemRefresher que contiene el objeto SWbemRefreshableItem.

Comentarios

El método GetObject de VBScript no se puede usar para crear objetos SWbemRefreshableItem directamente.

Ejemplos

El siguiente script ilustra la creación de un objeto SWbemRefresher y la adición de un solo objeto y enumerador SWbemRefreshableItem a él.

' Get some namespace connections
set cimv2 = GetObject("winmgmts:root\cimv2")
set default = GetObject("winmgmts:root\default")    

' Create a refresher
set refresher = CreateObject("WbemScripting.SWbemRefresher")

' Add a single object to the refresher.
' The @ is used because this is a singleton 
' system class so only one instance exists.
set item1 = refresher.Add (default, "__CIMOMIdentification=@").Object
MsgBox "WMI Version " item1
' Add an enumerator to the refresher.
' Note that the SWbemRefreshableItem.ObjectSet 
' property must be used to designate
' this as an object set rather than a single object.
set item2 = refresher.AddEnum (cimv2, "Win32_Process").ObjectSet

' Loop three times, refreshing the items

For I= 1 To 3
MsgBox "Refresh number " & I
refresher.Refresh

' Iterate through the collection of
' processes in item2 with name of wscript
    For each process in item2
        If process.name = "wscript.exe" then
        MsgBox "Process " & process.Name & _
           " Page Faults " & process.PageFaults
        End If
    Next 
Next

' Clear out the refresher
refresher.DeleteAll 

' The following should return 0
MsgBox "Number of items in Refresher after DeleteAll " _
    & refresher.Count

Requisitos

Requisito Value
Cliente mínimo compatible
Windows Vista
Servidor mínimo compatible
Windows Server 2008
Encabezado
Wbemdisp.h
Biblioteca de tipos
Wbemdisp.tlb
Archivo DLL
Wbemdisp.dll
CLSID
CLSID_SWbemRefreshableItem
IID
IID_ISWbemRefreshableItem

Consulte también

Objetos de API de scripting