If those connection strings refer to the same server, the only way for reliably find out the machine name is to connect to the server and run the following command:
select @@SERVERNAME
Sample code:
using (var cn = new SqlConnection(yourConnectionString))
{
cn.Open();
using (var cmd = new SqlCommand("Select @@SERVERNAME", cn))
{
Console.WriteLine(cmd.ExecuteScalar());
}
}