views:

38

answers:

1

I need to write SQL Query to Retrive the Following Settings of SQL Logins for SQL server 2005:

1.Enforce password policy

2.Enforce password expiration

3.User must change password at next login

Thanx in advance.

+1  A: 
SELECT * 
FROM sys.sql_logins

should give you the first two (is_policy_checked and is_expiration_checked columns)

and you can use SELECT LOGINPROPERTY('sa', 'IsMustChange') to find if the user must change password at next login

So putting it all into one query...

SELECT name,
    is_policy_checked,
    is_expiration_checked, 
    LOGINPROPERTY(name, 'IsMustChange') as is_must_change
FROM   sys.sql_logins
barrylloyd
Thank You very much
John
No problem, glad to help
barrylloyd