question

suesh avatar image
suesh asked

sql Script for finding sql login passwordexpiration days?

Can any one please provide me the script for finding sql login password expiration days and also that will send the alert before one week of expiration? Please provide me the full script because i am not aware of scripting side.
script
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image
Kev Riley answered
You would want to use the DaysUntilExpiration property returned from `LOGINPROPERTY` to get the number of days until the password expires. select *, LOGINPROPERTY(name, N'DaysUntilExpiration') AS DaysUntilExpiration from sys.server_principals ssp where type_desc = 'SQL_LOGIN' From that you can determine the expiration date, and trigger your alerting accordingly. See: http://msdn.microsoft.com/en-us/library/ms345412.aspx
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

suesh avatar image suesh commented ·
Hi Kev Riley, Thanks for your help.. Also provide me the script the will send alert before one week of password expiration?
0 Likes 0 ·
suesh avatar image
suesh answered
Can any one please send me the full script?
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.