Introduction
This post will explain you, how to find Exchange server version information. Basically, we can not find Exchange server version information from server console however we can find this from Active directory shema (i.e. ms-Exch-Schema-Version-Pt).
Now, we get this at run time (Exchange server version info) when we make connection with Exchange server. We can connect with n number of Exchange servers using n number of Exchange users.
In this feature, you do not need to know about Exchange server. Only you need to know about Core Java and Active directory (Internally configured with Exchange server).
First, we take a look, how can we access this using Softerra LDAP Browser (software Version 2.6).
Exchange Server Version information using LDAP Browser
1) Open LDAP browser, create a new profile for Exchange’s Active directory.
2) Provide profile name here,
3) Provide useful details for connection.
Host : Exchange server host / fully qualified DNS name
Port: LDAP port
Base DN: ‘CN=ms-Exch-Schema-Version-Pt, cn=schema, cn=configuration, dc=<domain>
For Example: Base DN = ‘CN=ms-Exch-Schema-Version-Pt, cn=schema, cn=configuration, dc=portmail, dc=com’
Click ‘Next’ to continue..
4) Provide useful information for directory user,
User DN: ‘CN=utest1, CN=Users,
Password:
For Example: CN=utest1, CN=Users, DC=portmail, DC=com
Click ‘Next’ to continue..
5) Provide filter information here.
6) Provide password of directory user here.
7) Here, you can see the value of ‘rangeUpper’ attribute. This returns integer value which is unique for Exchange servers.
These are unique codes for each Exchange servers.
- 4397: "Exchange Server 2000 RTM"
- 4406: "Exchange Server 2000 Service Pack 3"
- 6870: "Exchange Server 2003 RTM"
- 6936: "Exchange Server 2003 Service Pack 3"
- 10628:"Exchange Server 2007 RTM"
- 11116:"Exchange Server 2007 Service Pack 1"
- 11222:"Exchange Server 2007 Service Pack 2"
- 14625:"Exchange Server 2007 Service Pack 3"
- 12640:"Exchange Server 2010 RTM"
- 13214:"Exchange Server 2010 Service Pack 1"
Now we will understand how can we achieve this via Java code.
Exchange Server Version information using Java Utility
1. First, you need to establish connection with LDAP server.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.SECURITY_AUTHENTICATION, "Simple");
env.put(Context.SECURITY_PRINCIPAL, userID);
env.put(Context.SECURITY_CREDENTIALS, password);
env.put(Context.PROVIDER_URL, ldapURL);
ctx = new InitialLdapContext(env, null);
2. Once connection is done, you would need to search required attribute with filter information.
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
String[] attributes = {"rangeUpper"};
controls.setReturningAttributes(attributes);
String filter = "";
filter = "(&(objectClass=top)(objectClass=attributeSchema))";
NamingEnumeration values = ctx.search(dirSearch, filter, controls);
3. Now you get attribute value from values enumerator.