In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Recently received instructions from the leadership, said to do a domain password reminder service, this will be more user-friendly, employees do not have to wait for expiration to find the administrator to reset. But I don't understand the script, so I simply found some links from the Internet as a reference. Here, thanks to the author of this link, https://www.yeboyzq.com/windowsserver/632.html.
The following is the final process
Import-Module Activedirectory
$alladuser=get-aduser-searchbase "ou=,ou=,dc=*,dc=com"-Filter 'PasswordNeverExpires-eq "false"-and enabled-eq "true"' | ForEach {$_ .SamAccountName}
$userlist = @ ()
$itmag = "@ .com"
Function sendmail ($mailaddr,$body) # defines how to send mail
{
$msg=New-Object System.Net.Mail.MailMessage
$msg.To.Add ($mailaddr)
# $msg.Bcc.Add ($itmag)
$msg.From = New-Object System.Net.Mail.MailAddress ("@ .com", "@ .com", [system.Text.Encoding]:: GetEncoding ("UTF-8"))
$msg.Subject = "Domain account password is about to expire reminder!"
$msg.SubjectEncoding = [system.Text.Encoding]:: GetEncoding ("UTF-8")
$msg.Body = $body
$msg.BodyEncoding = [system.Text.Encoding]:: GetEncoding ("UTF-8")
$msg.IsBodyHtml = $false
# $msg.Priority = [System.Net.Mail.MailPriority]:: High
$client = New-Object System.Net.Mail.SmtpClient ("smtp.office365.com")
$client.Port = 587
$client.EnableSsl = $true
$client.UseDefaultCredentials = $false
$client.Credentials=New-Object System.Net.NetworkCredential ("@ .com", "password")
Try {$client.Send ($msg)} catch [Exception] {$($_ .Exception.message) $mailaddr}
}
Foreach ($user in $alladuser)
{
$pwdlastset= Get-ADUser $user-Properties |% {$_ .passwordlastset}
$pwdlastday=$pwdlastset.AddDays (90)
$now=get-date
$expire_days= ($pwdlastday-$now). Days
$chineseusername= Get-ADUser $user-Properties |% {$_ .Displayname}
$pwdset = $pwdlastset.ToString ('yyyyyyyyy year mm / ddday HH:mm:ss')
$pwdlast = $pwdlastset.AddDays (90). ToString ('yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
$tomailaddr = $user + "@ huobi.com"
If ($expire_days-lt 8-and $expire_days-ge 0)
{
# message body
$Emailbody=
"Dear $chineseusername:
Your domain account password will expire in $expire_days days. Please change it immediately.
Expiration period reference:
Last time password was set: $pwdset
Expiration time of this password: $pwdlast
This password is the password for wired networking, wireless networking, × ×, plus domain computers. To change the password, please follow the following principles: ○ password length is at least 10 digits; ○ mandatory password history 3 (cannot use the last 3 passwords previously used); ○ password can be used for up to 90 days, can be changed according to the link within 90 days, more than 90 days, please contact IT to change Beijing IT:**** Hainan IT:**** Shenzhen IT:**** ○ passwords meet the complexity requirements (three of the four types of uppercase letters, lowercase letters, numbers and symbols must be, And password password must not include all or part of the user name) ○ windows change: keyboard press Ctrl+Alt+Del ○ MACbook change please visit: Beijing: http:// Hainan: http:// Shenzhen: http:// "sendmail $tomailaddr $Emailbody} if ($expire_days-lt 0) {$Emailbody=" Dear $chineseusername: your domain account password has expired Please contact IT personnel to make changes. Last password set time: $pwdset this password expiration time: $pwdlast Beijing IT:**** Hainan IT:**** Shenzhen IT:**** "sendmail $tomailaddr $Emailbody}
}
Final email effect
Is about to expire.
Expired
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.