Powershell script to generate SQL server Inventory in CSV format

  • Comments posted to this topic are about the item Powershell script to generate SQL server Inventory in CSV format

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Nice script but seems to be a little outdated. Last known SQL-Version is 12 (SQL-2014) :-). If you have windows cluster with more than 2 nodes the script fails for such clusters and the possibility would be nice to get the server input beside a file also from a CMS (central management server). But it inspired me to enhance my own tool that it delivers more useful information. Thanks for that.

  • any way to capture server IP

  • I use this sql snippet to get servername/ip/port: technically, there could be more than one IP address if you have a multi subnet thing going on:

     

    --desc: gets the IP address of the server

    SELECT
    CONVERT(VARCHAR(128),@@SERVERNAME) AS ServerName,
    IPAddress,
    TCPPort
    FROM (
    SELECT local_net_address AS IPAddress,
    CONVERT(VARCHAR(30), local_tcp_port) AS TCPPort,
    local_net_address + ' | ' + CONVERT(VARCHAR(30), local_tcp_port) AS IpAndPort
    FROM sys.dm_exec_connections
    WHERE local_net_address is not NULL
    AND [protocol_type] = 'TSQL'
    AND [local_net_address] <> '127.0.0.1'
    ) x

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • ok thanks will check but then this would work only for standalone servers only , for sql failover cluster how can we acheieve the same

     

    • This reply was modified 2 weeks, 5 days ago by anoop.mig29.

Viewing 6 posts - 1 through 6 (of 6 total)

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