This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing one T-SQL Script to find SQL Server USER LOGIN Information.
As a DBA, we should check the USER LOGIN Information to make sure about the user expiration, password expiration.
Using password expiration information, you can also notify the user before its password expires.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
SELECT SL.name AS LoginName ,LOGINPROPERTY (SL.name, 'PasswordLastSetTime') AS PasswordLastSetTime ,LOGINPROPERTY (SL.name, 'DaysUntilExpiration') AS DaysUntilExpiration ,DATEADD(dd, CONVERT(int, LOGINPROPERTY (SL.name, 'DaysUntilExpiration')) , CONVERT(datetime, LOGINPROPERTY (SL.name, 'PasswordLastSetTime'))) AS PasswordExpiration ,SL.is_policy_checked AS IsPolicyChecked ,LOGINPROPERTY (SL.name, 'IsExpired') AS IsExpired ,LOGINPROPERTY (SL.name, 'IsMustChange') AS IsMustChange ,LOGINPROPERTY (SL.name, 'IsLocked') AS IsLocked ,LOGINPROPERTY (SL.name, 'LockoutTime') AS LockoutTime ,LOGINPROPERTY (SL.name, 'BadPasswordCount') AS BadPasswordCount ,LOGINPROPERTY (SL.name, 'BadPasswordTime') AS BadPasswordTime ,LOGINPROPERTY (SL.name, 'HistoryLength') AS HistoryLength FROM sys.sql_logins AS SL WHERE is_expiration_checked = 1 ORDER BY LOGINPROPERTY (SL.name, 'PasswordLastSetTime') DESC |
Leave a Reply