禁用用户账号 添加日期和属性
# import ad tool
Import-Module ActiveDirectory
#import user list
$a=get-content C:\xiaomi\disable-user-add-description\deluser.txt
$c = 0
$CheckTime = Get-Date -Format "yyyy-MM-dd"
foreach ($i in $a)
{
# disable adaccount
disable-ADAccount -Identity $i
$b = get-aduser $i -Properties * |select Description
$b = $b.Description + $CheckTime + "password exceed more than 30s"
Set-ADUser $i -Description $b
$c++
}
$Str = "AD Script has disabled $c users and loged in C:\xiaomi\disable-user-add-description\beforeusers.txt"
$Str