I am using function NetGetDCName, but this seems to fail (err 2453) on a production Active directory
I used nltest.exe to test
Output of nltest /DCNAME:dir
Status = 2453 0x995 NERR_DCNotFound
However nltest/DCLIST:dir seems to list all the domain controller including the PDC.
How does nltest/DCLIST work ? I guess nltest /DCNAME:dir is using NetGetDCName only and fails with same error as my code.
I also did a nslookup on the host where I am getting error. I see that the DNS that it is pointing to is not one of the domain controller host.
Any tips on how should I get the PDC programatically?