Sunday, February 19, 2012

blank passwords

Is there a way to test for blank passwords on logins using SMO?

There are no methods or properties in the Login object which will return any password data. Due to the hashed nature of the passwords you've got some challenges to determining whether or not the password is blank just by reading the password hash as well.

Your best bet would probably be to iterate through the Logins collection and for each Login object attempt to establish an ADO.Net connection to the database, supplying a blank password for the connection. (I used to have a T-SQL script that searched my network for SQL Servers with a blank 'sa' password, until I eliminated that problem here.)

|||

Thanks! I also have a Tsql script to check for blanks. Wanted to make sure i wasn't missing something here.

Is the performance acceptable iterating through the Login collection or would using TSQL and reading the results to a data table be the better route?

|||I don't think it makes any difference, really.

No comments:

Post a Comment