一、批量创建用户
for /l %i in (1,1,10) do net user test%i !QAZ2wsx /add
二、批量设置用户密码永不过期
for /l %i in (1,1,10) do net user test%i /expires:never 注意:此用户必须存在
三、批量创建用户到指定的用户组内
for /l %i in (1,1,10) do net user test%i !QAZ2wsx /add net localgroup "TelnetClients" test%i /add
四、批量删除用户
for /l %i in (1,1,10) do net user test%i !QAZ2wsx /delet /expires:Never
五、批量增加域用户
$Password = "!QAZ2wsx"
$SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
1..10 |foreach-object {New-ADUser -Name "test$_" -SamAccountName "test$_" -UserPrincipalName test$_@songchen.com -path "OU=test,DC=songchen,DC=com" -AccountPassword $SecurePassword -Enabled $true -ChangePasswordAtLogon $false}
同步时间服务器:w32tm /config /manualpeerlist:"ntp.aliyun.com" /syncfromflags:manual /reliable:yes /update
注意:第一步,第二步,第三步,第四步,必须用cmd命令行(管理员运行模式去运行)
第五步,用Powershell批量创建测试域用户
如有不懂的请参考链接:https://www.cnblogs.com/wulongy/p/14696228.html
浙公网安备 33010602011771号