|
|
FAQ
Search
Memberlist
Usergroups
Register
Profile
Private messages
Log in
|
|
| Author |
Message |
khack Guest
|
Posted: Sat Dec 22, 2007 12:35 am Post subject: How to determine Account Expires end of, Time |
|
|
We have a domain that spans 5 time zones and would like the AD Accounts to
expire at 5pm local time. How can we set this up ? The AD GUI only gives an
option to set a day.
Thanks, |
|
| Back to top |
|
 |
|
|
khack Guest
|
Posted: Sat Dec 22, 2007 12:35 am Post subject: Re: How to determine Account Expires end of, Time |
|
|
If I want an account to expire today at 5pm PST I could also set the expiry
for tomorrow and restrict login hours to deny login after 5pm Friday and deny
login all day Saturday. Just figured that out a few minutes ago......
Thanks for your suggestion.
"Richard Mueller [MVP]" wrote:
| Quote: |
"khack" <khack@discussions.microsoft.com> wrote in message
news:433DAF21-F34D-4684-AC04-E0E7F731747F@microsoft.com...
We have a domain that spans 5 time zones and would like the AD Accounts to
expire at 5pm local time. How can we set this up ? The AD GUI only gives
an
option to set a day.
You can use the AccountExpirationDate property method in a VBScript program
to assign any date/time value to the accountExpires attribute of a user
object. The date/time is the time zone of the computer used to make the
assignment, and the value is not adjusted for daylight savings time changes,
but you can easily work out when the account will expire in any time zone. A
VBScript example:
===========
' Bind to the user object.
' You must specify the full Distinguished Name of the user.
Set objUser = GetObject("LDAP://cn=Jim
Smith,ou=Sales,ou=West,dc=MyDomain,dc=com")
' Specify the date/time (in the local time zone) when the account will
expire.
' This example is 5:30 PM on February 10, 2007.
objUser.AccountExpirationDate = #02/10/2007 17:30#
' Save change.
objUser.SetInfo
========
The actual value saved in AD is in UTC (Coordinated Universal Time, or what
was once called GMT). The AccountExpirationDate property method makes the
conversion from your local time zone. However, the UTC time does not change
when daylight savings time changes, so the actual date/time in the current
time zone will shift by one hour when daylight savings changes. However, I
have tested, and the account really does expire within seconds of the
specified day and time. The value displayed in ADUC will reflect the end of
the previous day. An actual expiration of 02/04/2007 23:59:59 will show up
as end of the day 02/03/2007 in ADUC (which really means some time during
the day 02/04).
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
|
|
|
| Back to top |
|
 |
Richard Mueller [MVP] Guest
|
Posted: Sat Dec 22, 2007 12:35 am Post subject: Re: How to determine Account Expires end of, Time |
|
|
"khack" <khack@discussions.microsoft.com> wrote in message
news:433DAF21-F34D-4684-AC04-E0E7F731747F@microsoft.com...
| Quote: | We have a domain that spans 5 time zones and would like the AD Accounts to
expire at 5pm local time. How can we set this up ? The AD GUI only gives
an
option to set a day.
|
You can use the AccountExpirationDate property method in a VBScript program
to assign any date/time value to the accountExpires attribute of a user
object. The date/time is the time zone of the computer used to make the
assignment, and the value is not adjusted for daylight savings time changes,
but you can easily work out when the account will expire in any time zone. A
VBScript example:
===========
' Bind to the user object.
' You must specify the full Distinguished Name of the user.
Set objUser = GetObject("LDAP://cn=Jim
Smith,ou=Sales,ou=West,dc=MyDomain,dc=com")
' Specify the date/time (in the local time zone) when the account will
expire.
' This example is 5:30 PM on February 10, 2007.
objUser.AccountExpirationDate = #02/10/2007 17:30#
' Save change.
objUser.SetInfo
========
The actual value saved in AD is in UTC (Coordinated Universal Time, or what
was once called GMT). The AccountExpirationDate property method makes the
conversion from your local time zone. However, the UTC time does not change
when daylight savings time changes, so the actual date/time in the current
time zone will shift by one hour when daylight savings changes. However, I
have tested, and the account really does expire within seconds of the
specified day and time. The value displayed in ADUC will reflect the end of
the previous day. An actual expiration of 02/04/2007 23:59:59 will show up
as end of the day 02/03/2007 in ADUC (which really means some time during
the day 02/04).
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
-- |
|
| Back to top |
|
 |
|
|