前邊我們介紹到Windows Server 2016-圖形化新建域用戶(一) 及 Windows Server 2016-批量新建域用戶(二) ,裡邊提到了批量通過new-aduser常見帳號,這裡簡單的對前章節內容做個補充,具體信息如下: 命令語法: 常用欄位註解: 例:創建wen帳號: ...
前邊我們介紹到Windows Server 2016-圖形化新建域用戶(一) 及 Windows Server 2016-批量新建域用戶(二) ,裡邊提到了批量通過new-aduser常見帳號,這裡簡單的對前章節內容做個補充,具體信息如下:
命令語法:
New-ADUser [-Name] <string> [-AccountExpirationDate <System.Nullable[System.DateTime]>] [-AccountNotDelegated <System.Nullable[bool]>] [-AccountPassword <SecureString>] [-AllowReversiblePasswordEncryption <System.Nullable[bool]>] [-AuthType {<Negotiate> | <Basic>}] [-CannotChangePassword <System.Nullable[bool]>] [-Certificates <X509Certificate[]>] [-ChangePasswordAtLogon <System.Nullable[bool]>] [-City <string>] [-Company <string>] [-Country <string>] [-Credential <PSCredential>] [-Department <string>] [-Description <string>] [-DisplayName <string>] [-Division <string>] [-EmailAddress <string>] [-EmployeeID <string>] [-EmployeeNumber <string>] [-Enabled <System.Nullable[bool]>] [-Fax <string>] [-GivenName <string>] [-HomeDirectory <string>] [-HomeDrive <string>] [-HomePage <string>] [-HomePhone <string>] [-Initials <string>] [-Instance <ADUser>] [-LogonWorkstations <string>] [-Manager <ADUser>] [-MobilePhone <string>] [-Office <string>] [-OfficePhone <string>] [-Organization <string>] [-OtherAttributes <hashtable>] [-OtherName <string>] [-PassThru <switch>] [-PasswordNeverExpires <System.Nullable[bool]>] [-PasswordNotRequired <System.Nullable[bool]>] [-Path <string>] [-POBox <string>] [-PostalCode <string>] [-ProfilePath <string>] [-SamAccountName <string>] [-ScriptPath <string>] [-Server <string>] [-ServicePrincipalNames <string[]>] [-SmartcardLogonRequired <System.Nullable[bool]>] [-State <string>] [-StreetAddress <string>] [-Surname <string>] [-Title <string>] [-TrustedForDelegation <System.Nullable[bool]>] [-Type <string>] [-UserPrincipalName <string>] [-Confirm] [-WhatIf] [<CommonParameters>]
常用欄位註解:
Name | 姓名 |
AccountExpirationDate | 賬戶到期時間 |
City | 城市 |
Company | 公司 |
Department | 部門 |
Description | 描述 |
DisplayName | 顯示名稱 |
EmailAddress | 電子郵件地址 |
EmployeeID | 員工ID |
EmployeeNumber | 員工編號 |
HomePhone | 家庭電話 |
Manager | 經理 |
MobilePhone | 行動電話 |
Office | 辦公室 |
OfficePhone | 辦公室電話 |
Organization | 組織 |
PasswordNeverExpires | 密碼永不過期 |
SamAccountName | 用戶登錄名(老版本/不帶@) |
StreetAddress | 街道地址 |
Title | 職稱 |
UserPrincipalName | UPN用戶登錄名帶@符 |
例:創建wen帳號:
New-ADUser -Name wen -SamAccountName wen -UserPrincipalName [email protected] -AccountPassword (ConvertTo-SecureString "P@ssw0rd" -asplaintext -force) -enabled $true -ChangePasswordAtLogon $false