Voici une petite requête qui retourne quelques propriétés pour tous les logins d’un instance SQL Server, avec la prochaine date d’expiration des mots de passe …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ------------------------------- -- 22/01/2010 - Nicolas SOUQUET ------------------------------- WITH LOGIN_PROPERTIES AS ( SELECT SP.name , SP.type_desc , SP.is_disabled , SP.create_date , SP.modify_date , SP.default_database_name AS default_db , SP.default_language_name AS default_lang , CAST(LOGINPROPERTY(SP.name, 'PasswordLAstSetTime') AS DATETIME) AS password_last_set_time , CAST(LOGINPROPERTY(SP.name, 'DaysUntilExpiration') AS DATETIME) AS days_until_expiration FROM sys.server_principals AS SP ) SELECT name , type_desc , is_disabled , create_date , modify_date , default_db , default_lang , password_last_set_time , DATEADD(day, -DATEDIFF(day, password_last_set_time, GETDATE()), GETDATE()) + days_until_expiration AS password_expiry_date FROM LOGIN_PROPERTIES |
Bonne sécurisation !
ElSuket