Page 1 of 1 1
Topic Options
#116317 - 2004-03-17 11:15 PM AD account expiration, possible to script?
adj Offline
Lurker

Registered: 2004-03-17
Posts: 1
Hi,

Is it possible to show the accout expiration date in AD to users when they login? Is kix able to do this?..


Top
#116318 - 2004-03-17 11:28 PM Re: AD account expiration, possible to script?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I would say probably YES. A quick peek in EzAD Scriptomatic shows that it can be done in VBS so most likely the same is true for KiX.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#116319 - 2004-03-18 12:36 AM Re: AD account expiration, possible to script?
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
There is always...

Code:

If @MaxPWAge <> 4294967295
"Your password expires in " + (@MaxPWAge - @PWAge) + " days." ?
Else
"Your password is set to never expire." ?
EndIf




Edited by Chris S. (2004-03-18 12:38 AM)

Top
#116320 - 2004-03-18 01:16 AM Re: AD account expiration, possible to script?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Not sure where Chris got that number. It may be valid for Cisco and some other Firewalls and SAMBA

On my Windows 2000 AD with an account set to never expire that number has no validity.

Chris, you have a link to a MS white paper or KB that shows that?

Overall though the code that Chris supplied will give you what you're looking for.

Top
#116321 - 2004-03-18 01:18 AM Re: AD account expiration, possible to script?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
He said account expiration, not password.

The ADSI IADsUser property is AccountExpirationDate
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#116322 - 2004-03-18 01:49 AM Re: AD account expiration, possible to script?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Code:
break on
$objUser = GetObject ("WinNT://cacc/JBlow")

$AccountExpiration = $objUser.AccountExpirationDate


If @error <> 0 or $AccountExpiration = "1/1/1970"
"No account expiration specified" ?
Else
"Account expiration:"+ $objUser.AccountExpirationDate
EndIf

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#116323 - 2004-03-18 02:04 AM Re: AD account expiration, possible to script?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Sorry about that. You're right he did say Account not Password.

Yep your code works, and so does this for LDAP modified from Microsoft VB script for use with KiXtart.

Code:
Break On
DIM $RC
$RC=setoption('Explicit','on')
$RC=setoption('NoVarsInStrings','on')
DIM $objUser,$dtmAccountExpiration

$objUser = GetObject('LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com')
$dtmAccountExpiration = $objUser.AccountExpirationDate
If @ERROR <> 0 Or $dtmAccountExpiration = "1/1/1970"
? "No account expiration specified"
Else
? "Account expiration:" + $objUser.AccountExpirationDate
EndIf


Top
#116324 - 2004-03-18 02:17 AM Re: AD account expiration, possible to script?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
HEHEE
We both ripped the same code from M$.
I decided to use the WinNT provider cuz it is easier.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1110 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.064 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org