Dear Community
I have requirement to find out which database servers are my servers connected to . I do not have access to query SQL PS commands hence i come up with below script to query from server that i connected. The script is bit ok but i wanted to check with you all to see if there is any other better way i can do this .
$cmd = netstat -ano | findstr ":1433" $cmd = $cmd.split(10) $result = $cmd[10] $result = $result.replace(":1433", "") $DBServer = nslookup $result $DBServer = $DBServer | select-string "Name" write-host "Server connected to $DBServer"