Make a 100+ Server Inventory in 30 minutes

  • Android

    Grasshopper

    Points: 17

    Nice process. Would you happen to know how to either automatically populate the batch file with a listing of server names instead of manually (we have close to 200 servers and the list changes frequently) or have the batch file written to draw from another file which contains the list of servers (txt, csv, etc. format)?

    Thanks,

    Android

  • @Ashish

    Old Hand

    Points: 383

    There is no information of hard disk size in this command.

    Is there any other o/s command which can give you the current hard disk sizes?

    _________

    Regards,
    Ashish

  • marvin.meints

    SSC Rookie

    Points: 26

    I like the concept, I played with it and had good results in general. One thing to be aware of, is that this approach does not work in all environments. RPC has to be available for this to function.

    So, if you are in a "hardened" environment for security where the port are not available, the service is shut off, or any number of things like that, the script will fail generating a simple error message.

    So, while this is a great and simple solution, it has it limitations-only worked on a subset of the servers I deal with.

  • arr.nagaraj

    SSCertifiable

    Points: 6518

    @andriod,

    Try "sqlcmd -L" on the command prompt and check whether it helps you.

  • Kendal Van Dyke

    SSCertifiable

    Points: 5972

    Great tip to get a quick inventory!

    I wrote a similar blog post about using a free tool called SYDI that uses WMI to gather system information and query\persist it in SQL 2005: http://kendalvandyke.blogspot.com/2008/06/network-documentation-with-sql-2005-and.html. It gathers more information than systeminfo does but it's also slightly more complecated to implement. 🙂

    Kendal Van Dyke
    http://kendalvandyke.blogspot.com/[/url]

  • SQLRNNR

    SSC Guru

    Points: 281233

    Thanks - this was an informative and useful article.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • mkadiri

    SSC Enthusiast

    Points: 109

    Super tip! Very nice.

    I tried a variation (all sql hosts are already in a table): Open a cursor to select servername, then set a command to pull system info by servername, and execute it using xp_cmdshell @cmd,NO_OUTPUT. This can be written as a stored proc and then scheduled to run at will with a SQL Agent job.

  • SanjayAttray

    SSChampion

    Points: 13157

    Excellent info and tool Stanley. Tried now and it took less that 25 minutes to get info for 162 servers.

    Good thing is this tool generates the kind info which is very hard to get out of server from one place.

    Thanks again.

    SQL DBA.

  • Stuart Grace

    SSC Rookie

    Points: 42

    Very good article.

    I have wrote a batche file to create one csv file for all servers by using dsquery in conjunction with sysinfo.

    However, there is a bug with sysinfo with XP SP3. If running sysinfo with the csv output enabled, from an XP SP3 computer, then copy sysinfo.exe from a server (W2K3 server for example).

    example batch file - You will need to change the dsquery line to match the ou and domain that your servers are in. The csv file created is in c:\serverresults.csv:

    @echo off

    SET MYCOUNT = 0

    dsquery computer ou=Servers,dc=MyDomain,dc=com > %TEMP%\Serverlist.txt

    IF EXIST c:\serverresults.csv DEL c:\serverresults.csv

    FOR /F "tokens=2 delims==," %%i in (%TEMP%\serverlist.txt) do call :GETINFO %%i

    GOTO :FINISH

    :GETINFO

    SET SERVERNAME=%1

    SET /A MYCOUNT=%MYCOUNT% + 1

    IF "%MYCOUNT%" == "1" (

    systeminfo /s %SERVERNAME% /FO CSV >> c:\serverresults.csv

    ) ELSE (

    systeminfo /s %SERVERNAME% /FO CSV /NH >> c:\serverresults.csv

    )

    GOTO :EOF

    :FINISH

  • jddddd2

    SSC Enthusiast

    Points: 121

    Now that we know how to capture these info, including SQL info. Let's store it in SQL DB instead. What's the best SQL DB Schema if you want to store your SQL Servers and Databases when they're in this environment:

    - SQL clustering

    - Stand Alone

    - VMs

    (with multiple SQL instances)

    Has anyone come up with a good way to store them in a many-to-many relationship?

  • Jeff Moden

    SSC Guru

    Points: 995516

    Phil Factor (6/10/2010)


    This would be handy for a DBA if all the servers are in the domain, but rather than make a batch file with a list of all your servers by hand, you could get the list of all your registered SQL servers very easily from SMO, and, whilst you're doing it, collect as much SQL Server information as you want about them to combine with the systeminfo info.

    Hi Phil... have you got a link for the method you mention above?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Phil Factor

    SSCoach

    Points: 19959

    Hi Phil... have you got a link for the method you mention above?

    I use something similar myself. It is simple stuff. If you're interested I'll tidy it up as soon as I get a moment (Error handling? What error handling?) and send it to you. few of the servers I maintain are in the domain so I use a slightly more roundabout route....

    Best wishes,
    Phil Factor
    Simple Talk

  • @Ashish

    Old Hand

    Points: 383

    Phil Factor (6/10/2010)


    Hi Phil... have you got a link for the method you mention above?

    I use something similar myself. It is simple stuff. If you're interested I'll tidy it up as soon as I get a moment (Error handling? What error handling?) and send it to you. few of the servers I maintain are in the domain so I use a slightly more roundabout route....

    I am also interested in your approach. It would be nice if you can post it here

    _________

    Regards,
    Ashish

  • Steve Jones - SSC Editor

    SSC Guru

    Points: 717351

    If you want to use Powershell here, I found a cool script from SQL Chicken: http://sqlchicken.com/2010/06/powershell-i-heart-you/

  • Jeff Moden

    SSC Guru

    Points: 995516

    Phil Factor (6/10/2010)


    Hi Phil... have you got a link for the method you mention above?

    I use something similar myself. It is simple stuff. If you're interested I'll tidy it up as soon as I get a moment (Error handling? What error handling?) and send it to you. few of the servers I maintain are in the domain so I use a slightly more roundabout route....

    Very cool. Thanks, Phil. Hmmmm.... "error handling". I guess I'm going to have to look up the word "error" and find out what it actually means. 😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."

    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 16 through 30 (of 45 total)

You must be logged in to reply to this topic. Login to reply