定时修改Windows密码
2021-06-07 05:02
标签:datetime new dos amp sdc expect txt install tab #!/bin/env bash datetime= done user1 aa@qq.com set bsdcompat set from="ee@qq.com" 0 2 sun [ $(date +%d) -le 07 ] && /bin/bash /tools/pass/pass.sh 定时修改Windows密码 标签:datetime new dos amp sdc expect txt install tab 原文地址:https://blog.51cto.com/research/2383155cat /tools/pass/pass.sh
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 cat /tools/pass/user_list
user2 bb@qq.com
user3 cc@qq.comcat /etc/mail.rc
set smtp=smtp.qq.com
set smtp-auth-user=ee@qq.com
set smtp-auth-password=ypshshv3b1uadfg4crontab -l