建立文本文档另存为csv文件,注意编码格式,否则导入后是乱码
<a href="https://s2.51cto.com/wyfs02/M01/06/1D/wKiom1mx_rTgS1HaAADFk4mu5_g826.png-wh_500x0-wm_3-wmp_4-s_2507874724.png" target="_blank"></a>
<a href="https://s2.51cto.com/wyfs02/M01/A4/CE/wKioL1mx_p_yOnNGAACMSY5P9Ww834.png-wh_500x0-wm_3-wmp_4-s_2597880478.png" target="_blank"></a>
使用powellshell命令导入
Import-Csv -Path E:\users.csv | foreach { new-aduser -name $_.name -SamAccountName $_.samaccountname -GivenName $_.givenname -Surname $_.surname -DisplayName $_.displayname -Path $_.path -UserPrincipalName $_.userprincipalname -AccountPassword (ConvertTo-SecureString -string $_.accountpassword -AsPlainText -Force ) -Enabled $true -ChangePasswordAtLogon $false }
3.查看建立的用户
<a href="https://s4.51cto.com/wyfs02/M01/06/1D/wKiom1mx_yHQmLpKAABmhbLrwq8507.png-wh_500x0-wm_3-wmp_4-s_2552090050.png" target="_blank"></a>
本文转自 烟台小崔 51CTO博客,原文链接:http://blog.51cto.com/seawind/1963593