共用方式為


User

概要

管理本機使用者。

語法

User [String] #ResourceName
{
    UserName = [string]
    [DependsOn = [string[]]]
    [Description = [string]]
    [Disabled = [bool]]
    [Ensure = [string]{ Absent | Present }]
    [FullName = [string]]
    [Password = [PSCredential]]
    [PasswordChangeNotAllowed = [bool]]
    [PasswordChangeRequired = [bool]]
    [PasswordNeverExpires = [bool]]
    [PsDscRunAsCredential = [PSCredential]]
}

描述

資源 User 可讓您新增、更新和移除本機使用者帳戶。 若要管理本機群組中的帳戶成員資格,請參閱 群組資源

規格需求

屬性

金鑰屬性

使用者名稱

將帳戶的名稱指定為字串。

Type: System.String

選擇性屬性

描述

將帳戶的描述指定為字串。

Type: System.String
Default Value: None

已停用

指定是否停用帳戶。 將此屬性設定為 $true ,以在啟用帳戶時停用帳戶。 將它設定為 $false ,以在帳戶停用時啟用帳戶。

預設值是 $false

Type: System.Boolean
Default Value: false

Ensure

指定使用者是否應該存在。 將此屬性設定為 Present 以新增或更新帳戶。 將此屬性設定為 Absent 以移除帳戶。

預設值是 Present

Type: System.String
Behavior: Write
Accepted Values:
  - Absent
  - Present
Default Value: Present

FullName

將帳戶的完整名稱指定為字串。

Type: System.String
Default Value: None

密碼

指定具有要用於此帳戶之密碼的認證。 認證物件的 UserName 不會使用,只會使用 Password

Type: System.Management.Automation.PSCredential
Default Value: None

PasswordChangeNotAllowed

指定使用者是否可以變更其密碼。 將此屬性設定為 $true ,以防止使用者變更其密碼。 將此屬性設定為 $false ,以允許使用者變更其密碼。

預設值是 $false

Type: System.Boolean
Default Value: false

PasswordChangeRequired

指定使用者是否必須變更其密碼。 將此屬性設定為 $true ,以強制使用者在下次登入時變更其密碼。 將此屬性設定為 $false ,不需要使用者變更其密碼。

預設值是 $true

Type: System.Boolean
Default Value: true

PasswordNeverExpires

指定密碼是否過期。 將此屬性設定為 $true ,以防止帳戶的密碼過期。 將此屬性設定為 $false 讓帳戶的密碼在每個系統安全性設定到期。

預設值是 $false

Type: System.Boolean
Default Value: false

範例