简体   繁体   English

Powershell中的Active Directory密码到期

[英]Active Directory password expiration in powershell

When I retrieve the password expiration, it shows a date 6 months after they changed their password, when it is actually set to 3 months. 当我检索密码到期时,它显示了他们更改密码后6个月的日期,而实际上是3个月。 Is there a way to see this updated date? 有没有办法看到这个更新的日期? Or where is it being set at that I can pull that date in? 或将日期设置在什么位置?

I currently am using this to output: 我目前正在使用它来输出:

Get-ADUser -identity $ntaccount
@{ Name = "Expiration Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

Not sure what you are expecting to find but this code works properly. 不确定您期望找到什么,但是此代码可以正常工作。 Your code appears to be missing a couple of things. 您的代码似乎缺少了几件事。 Namely your first line does not feed into the second and your are not returning the needed property from Get-Aduser which is msDS-UserPasswordExpiryTimeComputed 即您的第一行没有输入第二行,并且您没有从Get-Aduser返回所需的属性, Get-Aduser msDS-UserPasswordExpiryTimeComputed

Get-ADUser -identity accountname -Properties msDS-UserPasswordExpiryTimeComputed | 
    select samaccountname,@{ Name = "Expiration Date"; Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

My account expires just under 42 days at the time of this post. 在撰写本文时,我的帐户过期时间不到42天。 My date is correct. 我的日期是正确的。

samaccountname Expiration Date     
-------------- ---------------     
myaccount      3/6/2015 11:34:29 AM

Are you expecting something else? 您还期待其他吗?

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

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