Win32_UserAccount 类别包含在 Win32 系统上的有关用户帐户的信息。
Imports System Imports System.Management Imports System.Windows.Forms
Namespace WMISample
Public Class CallWMIMethod
Public Overloads Shared Function Main() As Integer
Try
Dim classInstance As New ManagementObject( _ "root\CIMV2", _ "Win32_UserAccount.ReplaceKeyPropery='ReplaceKeyPropertyValue'", _ Nothing)
' Obtain [in] parameters for the method Dim inParams As ManagementBaseObject = _ classInstance.GetMethodParameters("Rename")
' Add the input parameters.
' Execute the method and obtain the return values. Dim outParams As ManagementBaseObject = _ classInstance.InvokeMethod("Rename", inParams, Nothing)
' List outParams Console.WriteLine("Out parameters:") Console.WriteLine("ReturnValue: {0}", outParams("ReturnValue"))
Catch err As ManagementException
MessageBox.Show("An error occurred while trying to execute the WMI method: " & err.Message) End Try End Function End Class End Namespace
乐博网附参数说明:
Rename() 用于重新命名用户帐户名称,它是该类的一个项。改变项属性“Name”的功能由一个能够为新组名提供独立上下文的方法实现。新组名是通过改变该类中与项名相关联的对象范例得到的,它不同于项名。 |