New-ADUser
[-AccountExpirationDate <DateTime>]
[-AccountNotDelegated <Boolean>]
[-AccountPassword <SecureString>]
[-AllowReversiblePasswordEncryption <Boolean>]
[-AuthenticationPolicy <ADAuthenticationPolicy>]
[-AuthenticationPolicySilo <ADAuthenticationPolicySilo>]
[-AuthType <ADAuthType>]
[-CannotChangePassword <Boolean>]
[-Certificates <X509Certificate[]>]
[-ChangePasswordAtLogon <Boolean>]
[-City <String>]
[-Company <String>]
[-CompoundIdentitySupported <Boolean>]
[-Country <String>]
[-Credential <PSCredential>]
[-Department <String>]
[-Description <String>]
[-DisplayName <String>]
[-Division <String>]
[-EmailAddress <String>]
[-EmployeeID <String>]
[-EmployeeNumber <String>]
[-Enabled <Boolean>]
[-Fax <String>]
[-GivenName <String>]
[-HomeDirectory <String>]
[-HomeDrive <String>]
[-HomePage <String>]
[-HomePhone <String>]
[-Initials <String>]
[-Instance <ADUser>]
[-KerberosEncryptionType <ADKerberosEncryptionType>]
[-LogonWorkstations <String>]
[-Manager <ADUser>]
[-MobilePhone <String>]
[-Name] <String>
[-Office <String>]
[-OfficePhone <String>]
[-Organization <String>]
[-OtherAttributes <Hashtable>]
[-OtherName <String>]
[-PassThru]
[-PasswordNeverExpires <Boolean>]
[-PasswordNotRequired <Boolean>]
[-Path <String>]
[-POBox <String>]
[-PostalCode <String>]
[-PrincipalsAllowedToDelegateToAccount <ADPrincipal[]>]
[-ProfilePath <String>]
[-SamAccountName <String>]
[-ScriptPath <String>]
[-Server <String>]
[-ServicePrincipalNames <String[]>]
[-SmartcardLogonRequired <Boolean>]
[-State <String>]
[-StreetAddress <String>]
[-Surname <String>]
[-Title <String>]
[-TrustedForDelegation <Boolean>]
[-Type <String>]
[-UserPrincipalName <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
创建.csv UTF-8 类型文件(附件下载模板).
Run powershell as administrator 以管理员账号运行powershell.
Import-Csv 'C:\temp\ADUsers.csv' | ForEach-Object {New-ADUser -SamAccountName $_.SamAccountName -Surname $_.Surname -GivenName $_.GivenName -Name $_.DisplayName -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName -EmailAddress $_.EmailAddress -Title $_.Title -Department $_.Department -OfficePhone $_.OfficePhone -MobilePhone $_.MobilePhone -Path $_.OU -AccountPassword(ConvertTo-SecureString -AsPlainText $_.Password -Force) -Enabled 1 -ChangePasswordAtLogon 1}