I'm goofling around and found this scripts PS which I can use to extract all servers with sql information, but I have no idea whta is actually this syntax does, how should I run this scripts? Yes I;ve installed PS in my machine, tried run it, but I dont get any output from the servername which has been input into allservers.txt
# usage: ./SQLVer.ps1
# Check SQL version
foreach ($svr in get-content "C:\data\AllServers.txt")
$con = "server=$svr;database=master;Integrated Security=sspi"
$cmd = "SELECT SERVERPROPERTY('ProductVersion') AS Version, SERVERPROPERTY('ProductLevel') as SP"
$da = new-object System.Data.SqlClient.SqlDataAdapter ($cmd, $con)
$dt = new-object System.Data.DataTable
$da.fill($dt) | out-null
$dt | Format-Table -autosize