学习自:
徐鹏老师的 AD Powershell 系列视频课程
创建一个启用的用户:
必要属性:
Name
SamAccountName
UserPrincipalName
DisplayName
Path
AccountPassword
New-ADUser -SamAccountName test01 -Name test01 -UserPrincipalName [email protected] -DisplayName "test 01" -Path "ou=Lab,dc=satid,dc=com" -AccountPassword (ConverTo-SecureString "[email protected]" -AsPlainTest -Force) -Enabled $true
批量创建10个用户
for{$i;$i -le 10;i++}
{
$user="user"+$i
$upn=$user+"@satid.com"
New-ADUser -SamAccountName $user -Name $user -UserPrincipalName $upn -DisplayName $user -Path "ou=Lab,dc=satid,dc=com" -AccountPassword (ConverTo-SecureString "[email protected]" -AsPlainTest -Force) -Enabled $true
}
转载于:https://blog.51cto.com/zhaodongwei/1963630