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
  • 97,193
  • 102
  • 206
  • 364
d.g
  • 321
  • 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
  • 34,223
  • 3
  • 62
  • 80
d.g
  • 321
  • 1
  • 3
  • 11