1

If I know a that SQL Express is installed on a given computer. I have the SA password to that database. However I do not know the Instance Name.

(So the connection string would be "Data Source=[IP Address]\????;User Id=sa;Password=[password]")

Without logging into the box, how can I determine what the instance name?

2
  • Without logging into the box... does that mean you don't have permission? Or are you just looking for a creative solution? Commented Nov 12, 2014 at 16:14
  • If I have 100 instances then I would not want to log into the box. Or if I wanted to know what was exposed on the network, or perhaps the user does not have remote desktoping enabled. Other reasons are possible as well. Commented Jan 28, 2015 at 19:20

1 Answer 1

1

If you have the SQL Server tools installed locally,

osql -L

will output a list of all available SQL Servers (including their instance names) in your current network.

Sign up to request clarification or add additional context in comments.

4 Comments

Works, except, A) does not work for "hidden" instances that are not broadcasting their names, B) nor for any instances that happen to be not started when this is run, and C) on larger networks, it typically does not find them all, even taking (A) and (B) into account (I don't know exactly why, I've always assumed it was some network thing). AFAIK, the only 100% reliable method is querying the Services list for every system in the network.
Thank you, that is very helpful. However iIt didn't work for me. I do see many (1000+) sql severs and instances however the one I am looking for is not on that list. I'm not sure why this is.
@JohnSmith The reasons for this are explained in my comment above.
Thanks for clearing that up! From another subnet I was able to get a different list.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.