Example #1
0
        public static Version GetConfiguredVersion(string roleName)
        {
            Version result  = null;
            string  keyName = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\ExchangeServer\\v15\\" + RolesUtility.GetRoleKeyByName(roleName, false);
            string  text    = (string)Registry.GetValue(keyName, "ConfiguredVersion", null);

            if (text == null)
            {
                keyName = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\ExchangeServer\\v15\\" + RolesUtility.GetRoleKeyByName(roleName, true);
                text    = (string)Registry.GetValue(keyName, "ConfiguredVersion", null);
            }
            if (text != null)
            {
                result = new Version(text);
            }
            else if (roleName == "AdminToolsRole")
            {
                Version unpackedVersion = RolesUtility.GetUnpackedVersion(roleName);
                if (unpackedVersion != null && unpackedVersion < AdminToolsRole.FirstConfiguredVersion)
                {
                    result = unpackedVersion;
                }
            }
            return(result);
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            Version unpackedVersion = RolesUtility.GetUnpackedVersion("AdminToolsRole");

            if (unpackedVersion != null && unpackedVersion < AdminToolsRole.FirstConfiguredVersion && RolesUtility.GetConfiguredVersion("AdminToolsRole") == null)
            {
                TaskLogger.Log(Strings.UpdatingAdminToolsConfiguredVersion(unpackedVersion.ToString()));
                RolesUtility.SetConfiguredVersion("AdminToolsRole", unpackedVersion);
            }
            TaskLogger.LogExit();
        }