随笔 - 52  文章 - 0 评论 - 2 阅读 - 84453
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

一、批量创建用户

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

posted on   松晨  阅读(1133)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示