Tomasz - I believe that you will see a difference between what date you see 
programmatically and what date you see in the GUI. If I remember correctly, if the GUI 
says an account expires on June 18th, using scripts to pull the expiration date you 
will actually get a date/time of 2400 (midnight) on June 17th. Assuming this is true, 
you just need to adjust you code to account for the difference.

Jeff 


Jeff Salisbury
Network Infrastructure and Security Manager

Belkin Corporation
Information Services
310 604-2061
310 604-2022 fax
www.belkin.com


-----Original Message-----
From: Tomasz Onyszko [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 21, 2004 10:12 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] Setting account expiration time date the script

I have Windows 2000 AD domain and for user account creation I'm using my
  own script creating users with ADSI. This script is working OK but I have a problem 
with setting usera acount expiration date with it. Below is a fragment of my code:

<code>
Set usr = UserOU.Create("user", "CN=" & strLogonName)

With usr
     (...)
     .AccountExpirationDate = strExDate
     .SetInfo
     (...)
End With
</code>

where strExDate is date string in following format: mm/dd/yyyy.

As You can see I use AccountExpirationDate function to set this date.

This works almost correct - te problem is that date set in directory is different 
(earlier) then this which is given as function attribute. For example, when I put 
7/31/2004 the dat in account attribute is 7/30/2004 (this is just example). Does 
anyone know this problem and solution ?? :)


I know that I can put value directly in user attribute but I want to avoid counting 
value to put in this attribute - or maybe someone has code for counting value to put 
in the account expire date property for given date?

--
Tomasz Onyszko [MVP]
[EMAIL PROTECTED]
http://www.w2k.pl
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Confidential
This e-mail and any files transmitted with it are the property
of Belkin Corporation and/or its affiliates, are confidential,
and are intended solely for the use of the individual or
entity to whom this e-mail is addressed.  If you are not one
of the named recipients or otherwise have reason to believe
that you have received this e-mail in error, please notify the
sender and delete this message immediately from your computer.
Any other use, retention, dissemination, forwarding, printing
or copying of this e-mail is strictly prohibited.
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to