Identifying read only domain controller through WMI

  • Thread starter Thread starter Sameeksha
  • Start date Start date
S

Sameeksha

Not sure which newsgroup this question should go to.

I want to find out, using .net c# code whether a domain controller on the
given machine is read only.
The logic I am using is as follows -
1. Use System.Management namespace - ManagementObject and ObjectSearcher
classes
2. First find out domain name for the given machine using
Win32_ComputerSystem class - DomainName property
3. Use the domain name obtained in step 2 to query Win32_NTDomain class for
the domain objects which have the given domain name
4. Iterate through these objects, find an object whose
DSPrimaryDomainControllerFlag is set to true. Read its DSWritableFlag
property. If it is false, the domain controller is read only.

Does this logic seem ok?
Posting the question since at present I am not able to test this code on a
machine with read only domain controller.
 
Back
Top