PutOptions Class
Specifies options for committing management object changes.
For a list of all members of this type, see PutOptions Members.
System.Object
System.Management.ManagementOptions
System.Management.PutOptions
[Visual Basic] Public Class PutOptions Inherits ManagementOptions [C#] public class PutOptions : ManagementOptions [C++] public __gc class PutOptions : public ManagementOptions [JScript] public class PutOptions extends ManagementOptions
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; // This example demonstrates how to specify a PutOptions using // PutOptions object when saving a ManagementClass object to // the WMI respository. class Sample_PutOptions { public static int Main(string[] args) { ManagementClass newClass = new ManagementClass("root/default", String.Empty, null); newClass["__Class"] = "class999xc"; PutOptions options = new PutOptions(); options.Type = PutType.UpdateOnly; try { newClass.Put(options); //will fail if the class doesn't already exist } catch (ManagementException e) { Console.WriteLine("Couldn't update class: " + e.ErrorCode); } return 0; } } [Visual Basic] Imports System Imports System.Management ' This example demonstrates how to specify a PutOptions using ' PutOptions object when saving a ManagementClass object to ' WMI respository. Class Sample_PutOptions Overloads Public Shared Function Main(args() As String) As Integer Dim newClass As New ManagementClass( _ "root/default", _ String.Empty, _ Nothing) newClass("__Class") = "class999xc" Dim options As New PutOptions() options.Type = PutType.UpdateOnly 'will fail if the class doesn't already exist Try newClass.Put(options) Catch e As ManagementException Console.WriteLine("Couldn't update class: " & e.ErrorCode) End Try 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
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)