How to get a list of servers running SQL by using Powershell ?

  • Hi
    I´ve tried to create scripts in Powershell to list all the SQL servers in our enviroment but hasn´t really had any success. I´m a newbee in Powershell.

    We have SQL 2008 R2 , SQL 2012 R2 and SQL 2016 + some Express servers and I want to get a list of which servers is running SQL and which version.
    Our network is divided so I can´t use osql -L to get a list, that´s why I am trying Powershell.

    Do You DBA´s have some nice ones, or tip how to do it ?

    With Regards

  • I trust Edwin to know what he's talking about, so here's a good article. I'd pay attention to the caveats because that's where the pain points may come from. Also, be sure you work with your network admin because you're basically acting like an attack on the network with this sort of approach.

    The scripts are written using the older style syntax, so you might want to update to the latest commands however the concepts are the same.

    The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
    Theodore Roosevelt

    The Scary DBA
    Author of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd Edition
    Product Evangelist for Red Gate Software

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

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