gpt4 book ai didi

powershell - PowerShell Get-ADUser密码到期的日期错误

转载 作者:行者123 更新时间:2023-12-03 00:59:10 24 4
gpt4 key购买 nike

我在PowerShell中执行以下命令:

Get-ADUser -Identity dummyUser -Properties *

当我检查AccountExpirationDate时,它给出的是明天的日期,而将其设置为Yesterday日期。如何获得确切日期?

最佳答案

我相信您正在寻找密码和帐户有效期

要确定密码有效期,您可以为特定用户使用以下命令:

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

另一个选项可让您定位广告中的所有人:
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")}}

关于确定AD帐户的到期日期:
get-aduser -identity mame -properties AccountExpirationDate,accountExpires | select samaccountname, `
@{Name="AccountExpirationDate";Expression={([datetime]::FromFileTime($_.AccountExpirationDate))}},`
@{Name="accountExpires";Expression={([datetime]::FromFileTime($_.accountExpires))}}

请注意,但是,如果帐户设置为永不过期,则输出将类似于:
samaccountname AccountExpirationDate accountExpires
-------------- --------------------- --------------
name 01/01/1601 00:00:00

关于powershell - PowerShell Get-ADUser密码到期的日期错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58421700/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com