Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How we can check whether exchange server is installed in a system using c#.

Thanks
Posted
Updated 26-Apr-12 19:36pm
v8
Comments
bbirajdar 25-Apr-12 9:19am    
I would have asked the system administrator instead..
Sebastian T Xavier 26-Apr-12 10:19am    
interesting !!!!!

Hi,

you could easily use WMI to read version of your exchange server.

C#
string search_term = "Vendor LIKE 'Microsoft%' AND Name = 'Exchange'";
string[] properties = new string[]{ "Version" };
SelectQuery query = new SelectQuery("Win32_Product", search_term, properties );
using (ManagementObjectSearcher search_product = new ManagementObjectSearcher(query))
using (ManagementObjectCollection products = search_product.Get())
  foreach (ManagementObject product in products)
  {         
      //save version
      string version = (string) product["Version"]; 
  } 
}


Microsoft's WMI-Tools is a great helper:
http://www.microsoft.com/download/en/details.aspx?id=24045[^]

With Best Regards
 
Share this answer
 
v3
Comments
Sebastian T Xavier 4-Apr-12 5:14am    
If you don't mind can I have a sample code.....
El_Codero 4-Apr-12 5:22am    
Added code example, but that's not usually. Try to get informations by yourself, it'll help you a lot. We're always doing our best to help at specified coding issues, but we're not doing your work. Look through WMI-Methods in WMI and you'll find a lot of useful things. And easy to use. Regards
Sebastian T Xavier 4-Apr-12 5:32am    
Thanks; but the above code doesn't seem to be working. "Products" contains Zero items.
El_Codero 16-Apr-12 10:07am    
Hi, please answer as a comment, not as solution. That's why I'm replying so late, I've luckily watched my old threads. Does it work for you now?Regards
Sebastian T Xavier 17-Apr-12 2:54am    
Thanks for your reply. The above code is not working for me. i don't know why the result contains Zero records.
I have got another WMI query "select Version from ExchangeServerState" which solves my issue. But I am eager to know why the above sample is not working.
Don't know why the above code is not working. Item count in Products is zero. Will there be any issues with my system configuration,.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900