Get sql user password expire details
SELECT
name AS 'LoginName'
,LOGINPROPERTY(name, 'BadPasswordCount') AS 'BadPasswordCount'
,LOGINPROPERTY(name, 'BadPasswordTime') AS 'BadPasswordTime'
,LOGINPROPERTY(name, 'DaysUntilExpiration') AS 'DaysUntilExpiration'
,LOGINPROPERTY(name, 'DefaultDatabase') AS 'DefaultDatabase'
,LOGINPROPERTY(name, 'DefaultLanguage') AS 'DefaultLanguage'
,LOGINPROPERTY(name, 'HistoryLength') AS 'HistoryLength'
,LOGINPROPERTY(name, 'IsExpired') AS 'IsExpired'
,LOGINPROPERTY(name, 'IsLocked') AS 'IsLocked'
,LOGINPROPERTY(name, 'IsMustChange') AS 'IsMustChange'
,LOGINPROPERTY(name, 'LockoutTime') AS 'LockoutTime'
,LOGINPROPERTY(name, 'PasswordHash') AS 'PasswordHash'
,LOGINPROPERTY(name, 'PasswordLastSetTime') AS 'PasswordLastSetTime'
,LOGINPROPERTY(name, 'PasswordHashAlgorithm') AS 'PasswordHashAlgorithm'
,DATEADD(dd,CONVERT(int, LOGINPROPERTY (name, 'DaysUntilExpiration')),CONVERT(datetime,LOGINPROPERTY(name,'PasswordLastSetTime'))) AS 'PasswordExpiration'
,is_policy_checked AS 'IsPolicyChecked'
FROM
sys.sql_logins
WHERE
is_expiration_checked
= 1
ORDER BY
name
Nice information
ReplyDeleteThanks for your feedback
DeleteVery good article, thanks for sharing
ReplyDelete