S'il vous plaît essayer ci-dessous le code,
string FullComputerName = "<Name of Remote Computer>";
ConnectionOptions options = new ConnectionOptions();
ManagementScope scope = new ManagementScope("\\\\" + FullComputerName + "\\root\\cimv2", options);
scope.Connect();
ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_TerminalService");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
ManagementObjectCollection queryCollection = searcher.Get();
foreach (ManagementObject queryObj in queryCollection)
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_TerminalService instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Started: {0}", queryObj["Started"]);
Console.WriteLine("State: {0}", queryObj["State"]);
Console.WriteLine("Status: {0}", queryObj["Status"]);
}
Source: - https://social.msdn.microsoft.com/Forums/vstudio/en-US/a25d3071-2283-41c6-9262-6860d7965963/how-to-check-remote-servers-terminal-status-using-c?forum=csharpgeneral
vérifier l'exemple complet ici https://msdn.microsoft.com/en-us/ library/mt703458 (v = vs.85) .aspx –