I am using the code below in my windows application to get local servers, when I was using SQL Server 2012 it was working without any errors, but when I downloaded SQL Server 2016, I got the exception :
Exception: An exception occurred in SMO while trying to manage a service. Inner Exception: Failed to retrieve data for this request.
The Code:
public List<string> findLocalServers()
{
    var servers = new List<string>();
    try
    {
        var serverCollection = new ManagedComputer().ServerInstances.Cast<ServerInstance>().Select(instance => String.IsNullOrEmpty(instance.Name) ?
                                        instance.Parent.Name : instance.Parent.Name)
                                    .ToArray();
        foreach (var server in serverCollection.Where(server => !servers.Contains(server)))
        {
            servers.Add(server);
        }
        return servers;
    }
    catch (Exception ex)
    {            
        return null;
    }
}
				
                        
I had same problem. These steps helped me.
Reference to
Microsoft.SqlServer.ConnectionInfoincreased to version 13.x.x.x (via Add reference -> and find upper version in Extensions). Same step forMicrosoft.SqlServer.Management.Sdk.SfcandMicrosoft.SqlServer.Smo.I did not find increased version for
Microsoft.SqlServer.SqlWmiManagement. So I removed reference to this assembly and via browse I foundedC:\Program Files\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.SqlServer.SqlWmiManagement.dll.That´s all.