![]() |
Languages »
VBScript »
General
Intermediate
A Method to get an overview of the SQL servers in a DomainBy graham the programmmerA Method to get an overview of the SQL servers in a Domain |
VBScript, Windows, DBA, Dev
|
||||||||
|
Advanced Search |
|
|
|
||||||||||||||||
Recently I had the pleasure of inherting 34 SQL servers. There was no documentation, in fact they did not know exactly how many they had on the network and each had been setup by different departments by people of differeing abilities and understanding. After the databases had been setup they were left to themselves and only became an issue every few months when the log files used up all the disk space as they were not being backed up.
Trying to get an idea of what I was up against by using Enterprise manager was proving time consuming, what I needed was a quick report to give me a feel for what was going on on all the servers so that I could form a plan of action. So in the end I wrote a small vbscript program to achive this.
First of all you need to get a list of all the servers in the domain that you are investigating, there a a number of ways to do this but the one I used was to use the osql utility that ships with sql server 2005, it can be found in the c:\program files\microsoft SQL Server\90\tools\binn folder by default.
This will list all SQL servers in the domain and if you are lucky all the instances as well, just run up a dos prompt, navigate to the binn folder and type in osql -L to get a list.
On my domain osql listed all the servers but did not pick up on all the instances, so once you have identified the servers check out the registry key -
HKLM\Software\microsoft\Microsoft SQL Server
and look at the InstalledInstances values, this lists all the instances running on the server.
Now you have got a list of servers you can generate the report, you will need admin access to the servers and sa access to the sql server instances and a pc with excel 2003 installed on it.
After a bit excel will popup and fill itself with the data extracted from the sql servers, it will then save the spreadhseet and close.
| You must Sign In to use this message board. | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 27 Sep 2007 Editor: |
Copyright 2007 by graham the programmmer Everything else Copyright © CodeProject, 1999-2009 Web20 | Advertise on the Code Project |