0

I want to connect via winrm to other computers. I got only the FQDN of the destination computer which i want to connect. I have no information of the destination whether it is in a trusted Domain. So the basic question is how do i now which Authentication mechanism is needed to connect? Are there any C# .NET methods to check that?

Or is the easier way to set the authentication mechanism to kerberos, and if it fails set it to negotiate?

WSManConnectionInfo wci = new WSManConnectionInfo(TargetUri, ShellUri.ToString(), Credential);
wci.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
Soner Gönül
  • 91,172
  • 101
  • 184
  • 324
d.g
  • 281
  • 1
  • 3
  • 11

1 Answers1

0

There is the solution

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();
David
  • 32,767
  • 3
  • 62
  • 78
d.g
  • 281
  • 1
  • 3
  • 11