How to Query when SQL Server 2005 SQL sql authenticated account will expire

  • I am trying to find a system table which will allow me to create a script which would send email to users before their password expires. We plan to enforce password expiration for all SQL accounts in our SQL 2005 environment, but before we do so I would like to have some type of notification in place. Thus far I have not been able to find any system table that is tracking when a user's password will expire. Does anyone know how to query this within SQL 2005?

  • - I don't know if you should put this in your SQLServer engine :unsure:

    - I think at SSC you'll find a clr module that queries AD to get expiration dates. SP_helplogins will provide you the instances logins.

    - check out dbmail to send your mail.

    - schedule the job in SQLAgent.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • I'm not concerned about AD accounts I only want to query the expiration date for SQL authenticated logins? If I can write a query to determine the expiration date of a SQL authenticated login my plan is to use dbmail and schedule a job nightly to notify users.

  • I don't have sql2005 on win2003 right now, but according to BOL

    you can check it using:

    LOGINPROPERTY ( 'login_name' ,

    { 'IsLocked' | 'IsExpired' | 'IsMustChange'

    | 'BadPasswordCount' | 'BadPasswordTime'

    | 'HistoryLength' | 'LockoutTime'

    | 'PasswordLastSetTime' | 'PasswordHash' }

    )

    So simple select may generate the list for you (based on the IsMustChange).

    LockoutTime : datetime the account has been locked out (history)

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Take a look at the following:

    Select name

    ,create_date

    ,modify_date

    ,default_database_name

    ,is_policy_checked

    ,is_expiration_checked

    ,loginproperty(name, 'DaysUntilExpiration')

    ,loginproperty(name, 'PasswordLastSetTime')

    From sys.sql_logins;

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Thank you for providing the extra parameters Jeffrey.

    Apparently those weren't in BOL sep. 2007

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • ALZDBA (7/19/2008)


    Thank you for providing the extra parameters Jeffrey.

    Apparently those weren't in BOL sep. 2007

    Interesting, I didn't even think about the version of BOL I was using - but I did test against a SQL Server 2005 instance.

    Jeffrey Williams
    Problems are opportunities brilliantly disguised as insurmountable obstacles.

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Hello,

    Were you able to setup a type of notification?

    If so, please share.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply