Where does it say that? I tried outputting from the same script and it
doesn't have an issue. The problem is probably because it sets it to
Midnight of the given day and that may be interpreted differently by
different programs...
Here is the output from a quick test
G:\TEMP\delete>test
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
7/31/2004
7/31/2004
F:\DEV\cpp\AccExp>accexp adorgtestuser -s 2k3dc02
AccExp V01.01.00cpp Joe Richards ([EMAIL PROTECTED]) August 2002
Account Expires: 7/31/2004 12:00 AM
The command completed successfully
Here is the script I used:
strlogonname="ADORGTESTUSER"
strExDate="7/31/2004"
set userou=getobject("LDAP://OU=TestUsersOU,OU=TestOU,DC=joe,DC=com")
Set usr = UserOU.Create("user", "CN=" & strLogonName)
With usr
.samaccountname=strlogonname
.AccountExpirationDate = strExDate
.SetInfo
End With
wscript.echo usr.accountexpirationdate
set newusr=getobject("LDAP://cn="& strlogonname
&",OU=TestUsersOU,OU=TestOU,DC=joe,DC=com")
wscript.echo newusr.accountexpirationdate
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tomasz Onyszko
Sent: Monday, June 21, 2004 1:12 PM
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/
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/