PowerShell和AD显示不同的用户到期date

运行后:

Set-ADUser username -AccountExpirationDate "05/18/2017 7:00:00 PM" Get-ADUser username -Properties AccountExpirationDate 

我在PowerShell中得到这个:AccountExpirationDate:2017/5/18 7:00:00 PM

但用户属性显示该帐户在2017年5月17日到期。

这是什么原因?

PowerShell输出

AD属性设置

以testing用户身份,并使用MMC GUI设置帐户expiraton。 然后使用Get-adUser查看所设置的值。当您在5/19/2017的GUIselect时,Get-Aduser将返回2017/8/20上午12:00:00

注意graphics用户界面如何说“结束”,不给你一个时间select,只有date。 这里“X”的结尾是第二天的0百小时。 此外,AD中的date/时间属性始终是UTC时间,而GUI趋于针对本地时区偏移进行调整。 https://msdn.microsoft.com/en-us/library/ms675098(v=vs.85).aspx

你可以用powershell来计算等效的GUI选项

 ((get-date "5/19/2017").addDays(1)).toUniversalTime()