C#检查两台计算机是否在受信任的域中(或者:决定winrm连接的身份验证机制)



我想通过winrm连接到其他计算机。我只得到了要连接的目标计算机的FQDN。我没有关于目标是否在受信任域中的信息。因此,基本问题是我现在如何连接需要哪个身份验证机制?是否有任何C#.NET方法可以对此进行检查?

还是将身份验证机制设置为kerberos,如果失败,则将其设置为协商?

WSManConnectionInfo wci = new WSManConnectionInfo(TargetUri, ShellUri.ToString(), Credential);
wci.AuthenticationMechanism = AuthenticationMechanism.Kerberos;

有解决方案

http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/0a5cb5a4-317c-4fcd-9221-85884af1217f

//Trusts for current domain
Domain currentDomain = Domain.GetCurrentDomain();
var domainTrusts = currentDomain.GetAllTrustRelationships();

相关内容

最新更新