Windows AD域查询属性-密码过期时间
Windows PowerShell命令方式查询:
net user zhou /domain找出 SamAccountName 的值为zhou的用户部分信息
PS C:\user\admin>net user zhou /domain
User name zhou
Full name zhou
Comment
User's comment
Country/region code 000(System Default)
Account active Yes
Account expires Never
Password last set 4/17/2023 5:54:19 PM
Password expires 5/29/2023 5:54:19 PM
Password changeable 4/18/2023 5:54:19 PM
Password required Yes
User may change password Yes
Get-ADUser -Identity liu 找出 SamAccountName 的值为 liu 的用户信息
PS C:\user\admin>Get-ADUser -Identity liu -properties * | Format-List Name,Accountex*,Password*
Name liu
AccountExpirationDate
AccountExpires 9223372036854775807
PasswordLastSet 5/29/2023 5:54:19 PM
PasswordExpired False
Java ldapTemplate方式查询密码过期时间
属性:msDS-UserPasswordExpiryTimeComputed
https://learn.microsoft.com/zh-cn/windows/win32/adschema/a-msds-userpasswordexpirytimecomputed
ldapTemplate.find(query, LdapUserInfo.class);
@Data
public final class LdapUserInfo {
/**
* 账号过期时间
*/
@Attribute(name = "accountExpires")
private String accountExpires;
/**
* 密码过期时间
*/
@Attribute(name = "msDS-UserPasswordExpiryTimeComputed")
private String msDSUserPasswordExpiryTimeComputed;
}
密码过期时间值为LargeInteger,转换为标准时间
此值表示自 1601 年 1 月 1 日 (UTC) 以来的 100 纳秒间隔数。 值
0
或0x7FFFFFFFFFFFFFFF
(9223372036854775807
) 指示帐户永不过期。
public static void main(String[] args) {
long LARGE_INTEGER_16010101 = 116445312000000000L;
String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
long javaTime = Long.parseLong("133298276599577673") - LARGE_INTEGER_16010101;
javaTime = Long.parseLong(String.valueOf(javaTime).substring(0, 13)) + 57599875L;
String dateStr = new SimpleDateFormat(TIME_FORMAT, Locale.CHINA).format(new Date(javaTime));
System.out.println(dateStr);
}
标签:javaTime,AD,zhou,Windows,name,过期,Password,String
From: https://www.cnblogs.com/xi-ke-xi/p/17446055.html