定时修改Windows密码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了定时修改Windows密码相关的知识,希望对你有一定的参考价值。
yum -y install mailx expect
cat /tools/pass/pass.sh
#!/bin/env bash
datetime=date +%Y-%m-%d" "%H":"%M
for user in awk ‘{print $1}‘ /tools/pass/user_list
;do
passwd=mkpasswd -d 5 -s 0 -l 20
#ansible windows -m win_command -a "net user $user $passwd"
ansible winserver -m win_command -a "net user $user $passwd"
email=grep $user /root/tools/pass/mail_list| awk ‘{print $2}‘
echo $passwd |mail -s "$datetime new windos system $user passwd" $email
echo $passwd $user >> $(date +%Y-%m-%d"-"%H":"%M).txt
done
cat /tools/pass/user_list
user1 [email protected]
user2 [email protected]
user3 [email protected]
cat /etc/mail.rc
set bsdcompat
set from="[email protected]"
set smtp=smtp.qq.com
set [email protected]
set smtp-auth-password=ypshshv3b1uadfg4
crontab -l
0 2 sun [ $(date +%d) -le 07 ] && /bin/bash /tools/pass/pass.sh
以上是关于定时修改Windows密码的主要内容,如果未能解决你的问题,请参考以下文章
windows postgresql定时备份 无需手动输入密码