powershell执行以下命令
Import-Csv 'C:ADUserData.csv' | ForEach-Object {New-ADUser -SamAccountName $_.SamAccountName -Surname $_.Surname -GivenName $_.GivenName -Name $_.Name -UserPrincipalName $_.UserPrincipalName -DisplayName $_.Name -Description $_.Name -Path $_.Path -AccountPassword(ConvertTo-SecureString -AsPlainText $_.AccountPassword -Force) -Enabled 1 -PasswordNeverExpires $true }
csv格式如下
SamAccountName | Surname | GivenName | Name | Group | UserPrincipalName | Path | AccountPassword |
账号名称 | 姓 | 名 | 姓名 | aaaaa@test.com | OU=OU,DC=dn,DC=com | 密码 |