Reputation: 7000
I have issue when using PowerShell Clear-ADAccountExpiration
to reset an account expiration date to Never
in Active directory.
Here's an account that is going to expire:
get-ADUser osbor_ri -properties * | select AccountExpirationDate,accountExpires | fl
AccountExpirationDate : 31/12/2013 17:00:00
accountExpires : 130330692000000000
As you can see it will expire on the 31/12/2013 17:00:00
.
I want to clear this expiration and set it to Never
expire; so I use the following cmdlet
:
Clear-ADAccountExpiration osbor_ri
This clears the AccountExpirationDate
varible in AD but doesn't clear accountExpires
to 0 instead it's set to 9223372036854775807
each time.
get-ADUser osbor_ri -properties * | select AccountExpirationDate,accountExpires | fl
AccountExpirationDate :
accountExpires : 9223372036854775807
But when I use the manual method in AD to set an account to never expire the accountExpires
varible is set to 0
.
get-ADUser osbor_ri -properties * | select AccountExpirationDate,accountExpires | fl
AccountExpirationDate :
accountExpires : 0
Why does the Powershell Clear-ADAccountExpiration
not clear down accountExpires
varible to 0
in the same way that the manual method does when setting an account to never expire?
Also does leaving the accountExpires = 9223372036854775807
mean the account will still expire as some point?
Upvotes: 2
Views: 5730
Reputation: 9854
The date when the account expires. This value represents the number of 100-nanosecond intervals since January 1, 1601 (UTC). A value of 0 or 0x7FFFFFFFFFFFFFFF (9223372036854775807) indicates that the account never expires.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms675098(v=vs.85).aspx
Upvotes: 2