سؤال

The static method of GetCurrentDomain() works without issue but, when I try to use another method such as FindDomainController(), I receive a MethodNotFound exception error.

هل كانت مفيدة؟

المحلول

Use Domain.FindDomainController method to find all DC in the domain:

[System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain().DomainControllers

[System.DirectoryServices.ActiveDirectory.Domain] doesn't have a FindDomainController() method.

or use Domain.FindDomainController Method

 [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().FindDomainController()

This one finds any domain controller in the domain. There is no guarantee that the same domain controller will be found by another call to this method.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top