1.导出用户属性
Get-ADUser -Filter * -Properties * -SearchBase "OU=ll,DC=ll,DC=com " |
select samaccountname ,description, created,PasswordLastSet ,sid, city|Export-Csv -Encoding Unicode -NoTypeInformation userinfo.csv
2.导出账号
Get-ADUser -Filter * -Properties * -SearchBase "OU=ll,DC=ll,DC=com " | select
name,SamAccountName,userprincipalname,givenname,surname,displayname,accountpassword |Export-Csv -Encoding Unicode -NoTypeInformation userinfo001.csv
3.账号导入
Import-Csv -Encoding Unicode user.csv | % {New-ADUser -Name $_ .name -SamAccountName $_. SamAccountName -userprincipalname $_ .userprincipalname -givenname $_. givenname -surname $_.surname -displayname $_ .name -accountpassword $password -enabled $true -path "OU=ll,DC=ll,DC=com"}
转载于:https://blog.51cto.com/lvguangbaba/1893178