Identifying read only domain controller through WMI

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top