none
Unable to get 'Exchange Server' machines in current domain using 'Default naming context' in 'Active Directory' RRS feed

  • Question

  • HI,

    I have to find all 'Server machines' in the Current Domain using 'DefaultNamingContext' in Active Directory.

    I searched with query (ObjectClass=computer), but it results with all the machines in the currrent domain, while i need only server machines from current domain.

    Is there any differentiating key that signify whether any machine is server machine or normal machine.

    I searched the same in 'ConfigurationNamingContext' with search query (ObjectClass=msExch-ExchangeServer) but i get all the exchange servers in the whole forest.

    Any suggestion is appreciable.

    Thanks,

    Sanjeev



    • Edited by San23041 Thursday, May 10, 2012 6:58 AM
    Wednesday, May 9, 2012 3:20 PM

All replies

  •  Hi

    welocmes you to MSDN forums..

    May be this will helps to you..

    First you find all the os version details in your network, Based on your OS version U can easily find out whether it is Server or Not. After that u may collect the exchange server list using the previous server's list. 

    eg..

    public string GetOsVersion(string ipAddress) 
        { 
            using (var reg = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, ipAddress)) 
            using (var key = reg.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\")) 
            { 
                return string.Format("Name:{0}, Version:{1}", key.GetValue("ProductName"), key.GetValue("CurrentVersion")); 
            } 
        } 

     

     


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"

    Thursday, May 10, 2012 5:08 AM
  • HI Jo,

    thanks a lot for your quick response...

       Please take my question as below:

           "Unable to get 'Exchange Server' machines in current domain using 'Default naming context' from 'Active Directory'."

       updated details are as below:

    HI,

    I have to find all 'Exchange Server machines' in the Current Domain using 'DefaultNamingContext' in Active Directory.

    I searched with query (ObjectClass=computer), but it results with all the machines in the currrent domain, while i need only 'exchange server' machines in current domain.

    Is there any differentiating 'property attribute' in Active Directory that signify whether any machine is a server machine or a user machine.

    I also searched the same in 'ConfigurationNamingContext' with search query (ObjectClass=msExch-ExchangeServer) And i get all the exchange servers in the whole forest,  while i need only current domain's Exchange Server machines.

    Is there any 'property attribute' in 'ConfigurationNamingContext' to search exchange server machines only in current domain(Child Domain).

    Any suggestion is appreciable.

    Thanks & best Regards,

    Sanjeev


    • Edited by San23041 Thursday, May 10, 2012 11:09 AM
    Thursday, May 10, 2012 6:50 AM