我正在使用 Azure Active Directory,想知道用户的密码何时过期。
目前,我使用这些 PowerShell 命令成功连接到 msol 服务并获取密码到期日期,但我不太确定如何获取密码到期日期。
我正在使用 Azure Active Directory PowerShell 模块。
Connect-MsolService
Get-MsolUser -UserPrincipalName 'Username' | Select PasswordNeverExpires
最佳答案
您正在查找 LastPasswordChangeTimestamp
属性:
Get-MsolUser -UserPrincipalName 'Username' |Select LastPasswordChangeTimestamp
这只会告诉您密码上次更改的时间,而不是密码过期的时间,因此还要从密码策略中获取密码有效性:
$PasswordPolicy = Get-MsolPasswordPolicy
$UserPrincipal = Get-MsolUser -UserPrincipalName 'Username'
$PasswordExpirationDate = $UserPrincipal.LastPasswordChangeTimestamp.AddDays($PasswordPolicy.ValidityPeriod)
$PasswordExpirationDate
现在应该具有密码过期的时间戳
关于powershell - 在 PowerShell 中获取 Azure Active Directory 密码到期日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43294517/