Using C# I want to determine which DC (or at least which Site) the Exchange Server I am programming against is using.
I have a "User creation tool" and if it creates the user on a DC on the local site and then tries to enable the user on a DC in the Exchange server's site (Exchange 2010 remote ps cmdlet) it will error with the "object not found" since replication hasn't happened. If I ensure that I get the same DC as the server, then I won't have that problem.
basically a C# way of doing nltest /DSGETDC on the remote exchange server would be perfect
Thanks for your insight.
You can try the native API DsGetDcName from C# using pinvoke code.