public IServerEnvironment3 GetServerEnvironment()
        {
            UID uid = new UIDClass();

            uid.Value = "{32D4C328-E473-4615-922C-63C108F55E60}";

            //use activator to cocreate singleton
            Type t = Type.GetTypeFromProgID("esriSystem.EnvironmentManager");

            System.Object       obj = Activator.CreateInstance(t);
            IEnvironmentManager environmentManager = obj as IEnvironmentManager;

            return(environmentManager.GetEnvironment(uid) as IServerEnvironment3);
        }
        /**
         * This method returns a Server property value
         */
        public Object GetServerProperty(string propertyName)
        {
            Object propertyValue       = null;
            Type   envMgrType          = Type.GetTypeFromProgID("esriSystem.EnvironmentManager");
            object envMgrObj           = Activator.CreateInstance(envMgrType);
            IEnvironmentManager envMgr = envMgrObj as IEnvironmentManager;
            UID envUID = new UIDClass();

            envUID.Value = "{32D4C328-E473-4615-922C-63C108F55E60}";
            IServerEnvironment2 serverEnvironment = (IServerEnvironment2)envMgr.GetEnvironment(envUID);
            IPropertySet        serverProps       = serverEnvironment.Properties;

            propertyValue = serverProps.GetProperty(propertyName);

            return(propertyValue);
        }