Page 1 of 1 1
Topic Options
#205754 - 2012-09-13 02:58 PM AD Password Expiry
Fergieman Offline
Getting the hang of it

Registered: 2010-02-25
Posts: 58
Loc: Ireland
Guys

Is there any scripts to pull back when a users account's password is going to expiry ?

So , when it runs it will say "your password will expire in 10 days" ?

Thanks

Top
#205755 - 2012-09-13 03:39 PM Re: AD Password Expiry [Re: Fergieman]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Have you tried looking in the UDF section? There is the CheckPasswordExpiration() UDF that sounds like what you want.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#205756 - 2012-09-13 08:55 PM Re: AD Password Expiry [Re: Les]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
I'm not sure how dependable it is (I dont have AD to test with), but you could also try the built in kix macros.

 Code:
? "Max PW Age: "+@MaxPWAge
? "PW Age: "+@PWAge
?
? "PW Expires in: "+(@MaxpWAge-@PWAge)

get $

Top
#205757 - 2012-09-14 10:56 AM Re: AD Password Expiry [Re: ShaneEP]
Fergieman Offline
Getting the hang of it

Registered: 2010-02-25
Posts: 58
Loc: Ireland
thanks guy

Ive tested out the UDF you mentioned.

when I run it I get the message
Error: array reference out of bounds!
Line : 217

Top
#205758 - 2012-09-14 11:12 AM Re: AD Password Expiry [Re: Fergieman]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This UDF has depends on antoher UDF. See the UDF header. Did you also include this UDF?

Can you post the code you used for testing?

 Quote:
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#205759 - 2012-09-14 01:09 PM Re: AD Password Expiry [Re: Fergieman]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
No need for UDF complexity, as Shane pointed out. Here's a small enhancement:
 Code:
$Exp = @MaxpWAge-@PWAge			; find # of days before expiration
$Max = 14				; alert when MAX or fewer days left


If $Exp < 0				; never (or already has - probably not possible during login)
  'Your password never expires.' ?	; message probably not needed
Else
  Select
   Case $Exp = 0			; today
    $When = 'today!'
   Case $Exp = 1			; tomorrow
    $When = 'tomorrow!'
   Case $Exp <= $Max			; soon
    $When = 'in ' + $Exp + ' days!'
   Case 1				; much later... no message needed
    $When = ''
 EndSelect

  If $When				; should we display a message at all?
    'Your password expires ' + $When ?
  EndIf
EndIf
Note the minor update to eliminate a message when the password expires more than $Max days away.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205760 - 2012-09-14 03:59 PM Re: AD Password Expiry [Re: Glenn Barnas]
Fergieman Offline
Getting the hang of it

Registered: 2010-02-25
Posts: 58
Loc: Ireland
Wow , excellent Glenn...thanks..nice and sweet
Top
#205761 - 2012-09-14 05:25 PM Re: AD Password Expiry [Re: Fergieman]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Made a small update (no message unless "the end is near" ;\) ) and added comments to the example.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205762 - 2012-09-15 12:25 AM Re: AD Password Expiry [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Never - or until you're let go \:D
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 793 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.127 seconds in which 0.103 seconds were spent on a total of 13 queries. Zlib compression enabled.

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