天天看點

使用powershell批量導入AD使用者

建立文本文檔另存為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

繼續閱讀