Instance Class
Represents derived classes known to be management instrumentation instance classes. These derived classes inherit an implementation of IInstance that allows instances to be published through the Published property.
For a list of all members of this type, see Instance Members.
System.Object
System.Management.Instrumentation.Instance
[Visual Basic] MustInherit Public Class Instance Implements IInstance [C#] public abstract class Instance : IInstance [C++] public __gc __abstract class Instance : public IInstance [JScript] public abstract class Instance implements IInstance
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Example
[C#] using System; using System.Management; using System.Configuration.Install; using System.Management.Instrumentation; // This sample demonstrates how to create a Management Instrumentation Instance // class and how to publish an instance of this class to WMI. // Specify which namespace the Instance class is created in [assembly:Instrumented("Root/Default")] // Let the system know InstallUtil.exe utility will be run against // this assembly [System.ComponentModel.RunInstaller(true)] public class MyInstaller : DefaultManagementProjectInstaller {} // Create a Management Instrumentation Instance class [InstrumentationClass(InstrumentationType.Instance)] public class InstanceClass : Instance { public string SampleName; public int SampleNumber; } public class Sample_InstanceProvider { public static int Main(string[] args) { InstanceClass instClass = new InstanceClass(); instClass.SampleName = "Hello"; instClass.SampleNumber = 888; // Publish this instance to WMI instClass.Published = true; return 0; } } [Visual Basic] Imports System Imports System.Management Imports System.Configuration.Install Imports System.Management.Instrumentation ' This sample demonstrate how to create a Management Instrumentation Instance ' class and how to publish an instance of this class to WMI. ' Specify which namespace the Instance class is created in <assembly: Instrumented("Root/Default")> ' Let the system know InstallUtil.exe utility will be run against ' this assembly <System.ComponentModel.RunInstaller(True)> _ Public Class MyInstaller Inherits DefaultManagementProjectInstaller End Class ' Create a Management Instrumentation Instance class <InstrumentationClass(InstrumentationType.Instance)> _ Public Class InstanceClass Inherits Instance Public SampleName As String Public SampleNumber As Integer End Class Public Class Sample_InstanceProvider Overloads Public Shared Function Main(args() As String) As Integer Dim instClass As New InstanceClass() instClass.SampleName = "Hello" instClass.SampleNumber = 888 ' Publish this instance to WMI instClass.Published = True Return 0 End Function End Class
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Management.Instrumentation
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Management (in System.Management.dll)
See Also
Instance Members | System.Management.Instrumentation Namespace