ComputerPrincipal 构造函数

定义

初始化 ComputerPrincipal 类的新实例。Initializes a new instance of the ComputerPrincipal class. 调用 Save() 之前,必须在对象上设置 Context 属性。The Context property must be set on the object prior to calling Save().

重载

ComputerPrincipal(PrincipalContext)

初始化 ComputerPrincipal 类的新实例,并将其分配到指定上下文。Initializes a new instance of the ComputerPrincipal class and assigns it to the specified context.

ComputerPrincipal(PrincipalContext, String, String, Boolean)

使用指定的上下文、SAM 帐户名、密码和启用的值初始化 ComputerPrincipal 类的新实例。Initializes a new instance of the ComputerPrincipal class by using the specified context, SAM account name, password, and enabled value.

注解

计算机主体帐户在创建后不会持久保存。The computer principal account is not persisted when it is created. 若要持久保存帐户,请调用 Save 方法。To persist the account, call the Save method.

ComputerPrincipal(PrincipalContext)

初始化 ComputerPrincipal 类的新实例,并将其分配到指定上下文。Initializes a new instance of the ComputerPrincipal class and assigns it to the specified context.

public:
 ComputerPrincipal(System::DirectoryServices::AccountManagement::PrincipalContext ^ context);
public ComputerPrincipal (System.DirectoryServices.AccountManagement.PrincipalContext context);
new System.DirectoryServices.AccountManagement.ComputerPrincipal : System.DirectoryServices.AccountManagement.PrincipalContext -> System.DirectoryServices.AccountManagement.ComputerPrincipal
Public Sub New (context As PrincipalContext)

参数

context
PrincipalContext

PrincipalContext,用于指定要对其执行操作的服务器或域。The PrincipalContext that specifies the server or domain against which operations are performed.

注解

计算机主体帐户在创建后不会持久保存。The computer principal account is not persisted when it is created. 若要保存帐户,请调用 Save 方法。To save the account, call the Save method.

适用于

ComputerPrincipal(PrincipalContext, String, String, Boolean)

使用指定的上下文、SAM 帐户名、密码和启用的值初始化 ComputerPrincipal 类的新实例。Initializes a new instance of the ComputerPrincipal class by using the specified context, SAM account name, password, and enabled value.

public:
 ComputerPrincipal(System::DirectoryServices::AccountManagement::PrincipalContext ^ context, System::String ^ samAccountName, System::String ^ password, bool enabled);
public ComputerPrincipal (System.DirectoryServices.AccountManagement.PrincipalContext context, string samAccountName, string password, bool enabled);
new System.DirectoryServices.AccountManagement.ComputerPrincipal : System.DirectoryServices.AccountManagement.PrincipalContext * string * string * bool -> System.DirectoryServices.AccountManagement.ComputerPrincipal
Public Sub New (context As PrincipalContext, samAccountName As String, password As String, enabled As Boolean)

参数

context
PrincipalContext

PrincipalContext,用于指定要对其执行操作的服务器或域。The PrincipalContext that specifies the server or domain against which operations are performed.

samAccountName
String

此计算机主体的 SAM 帐户名。The SAM account name for this computer principal.

password
String

此帐户的密码。The password for this account.

enabled
Boolean

一个布尔值,指定是否启用帐户。A Boolean value that specifies whether the account is enabled.

注解

计算机主体帐户在创建后不会持久保存。The computer principal account is not persisted when it is created. 若要持久保存帐户,请调用 Save 方法。To persist the account, call the Save method.

适用于