简体   繁体   English

PowerShell Get-ADUser 密码过期给出了错误的日期

[英]PowerShell Get-ADUser password expiration is giving the wrong date

I have the following command executed in PowerShell:我在 PowerShell 中执行了以下命令:

Get-ADUser -Identity dummyUser -Properties *

When I check the AccountExpirationDate it is giving tomorrow's date whereas it was set to Yesterday date.当我检查 AccountExpirationDate 时,它给出了明天的日期,而它被设置为昨天的日期。 How can I get the exact date?我怎样才能得到确切的日期?

I believe you're looking for password and account expiration我相信您正在寻找密码和帐户到期

To identify password expiration you can use the following for a particular user:要识别密码过期,您可以对特定用户使用以下内容:

Get-ADUser -identity name –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |
Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

Another option which allows you to target everyone within your AD:另一个允许您定位广告中每个人的选项:

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | 
Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

With regards to identifying an AD account expiration date:关于识别 AD 帐户到期日期:

get-aduser -identity mame -properties AccountExpirationDate,accountExpires | select samaccountname, `
@{Name="AccountExpirationDate";Expression={([datetime]::FromFileTime($_.AccountExpirationDate))}},`
@{Name="accountExpires";Expression={([datetime]::FromFileTime($_.accountExpires))}}

Do note, however, if the account is set to never expire your output will look similar to:但是请注意,如果帐户设置为永不过期,您的 output 将类似于:

samaccountname AccountExpirationDate accountExpires
-------------- --------------------- --------------
name           01/01/1601 00:00:00   

I guess you have Fine-Grained Password Policy enabled.我猜您启用了细粒度密码策略

To get the get the Active Directory fine-grained password policy, use:要获取获取 Active Directory 细粒度密码策略,请使用:

To get the resultant password policy for a user, use:要获取用户的最终密码策略,请使用:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM