We came up with a series of SQL Server instance checks for the login used in our software product. One of the checks examines the login and determines if it's locked out. The code in the check needs to be tested so naturally we need a locked out login.

I've seen a lot of material on how to lock out a login after N failed attempts by changing the security policy. As we're subject to outsourced IT services, a request for such a change might be denied or placed at the bottom of the priorities list.

Is there a way to deliberately cause a lock out without making changes to the security policy?

  • A simple way might be to create a bat file with a finite loop (15-20 times) that uses SQLCMD to attempt to run a simple query (SELECT @@VERSION) with the sql login, but invalid password. Commented Oct 30, 2017 at 9:39
  • @Scott Hodgin: That didn't lock out the login due to there not being a security policy restriction.
    – Ruutsa
    Commented Oct 31, 2017 at 9:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.