Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
PutOptions Class
Collapse the table of content
Expand the table of content

PutOptions Class

Specifies options for committing management object changes.

For a list of all members of this type, see PutOptions Members.


[Visual Basic]
Public Class PutOptions
   Inherits ManagementOptions
public class PutOptions : ManagementOptions
public __gc class PutOptions : public ManagementOptions
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.


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",
        newClass["__Class"] = "class999xc";

        PutOptions options = new PutOptions(); 
        options.Type = PutType.UpdateOnly;

            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, _
        newClass("__Class") = "class999xc"

        Dim options As New PutOptions()
        options.Type = PutType.UpdateOnly 'will fail if the class doesn't already exist

        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 Language Filter in the upper-left corner of the page.


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)

See Also

PutOptions Members | System.Management Namespace

© 2015 Microsoft