Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Uninstall of Otter Management installer

    Scheduled Pinned Locked Moved Support
    2 Posts 2 Posters 25 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      philwaller5269_6322
      last edited by

      Hi

      I have twice installed The Otter 'Management' component on two different VM's and twice i have had to revert to a snapshot of the image due to the installer not invoking, i.e. not uninstalling

      it prompts for "do you want to delete data in the DB" and then nothing - this is via Add/remove progs

      even when running the uninstall routine from the Otter directory - nothing

      please advise

      1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer
        last edited by

        The uninstaller found within the traditional installer (i.e. not the Inedo Hub) can be a bit tricky to debug... this is one of the many reasons behind building the Inedo Hub. We will likely only support the Hub next year.

        If you're not getting any errors when you run the installer, the easiest way to diagnose the uninstaller is by following the code. It may be a missing registry key, permissions, etc.

        You can also use the code to see exactly what needs to be uninstalled, should you need to do it manually.

                public static void Uninstall(UninstallOptions options)
                {
                    string servicePath;
                    string webPath;
                    try
                    {
                        GetRegistryInfo(out servicePath, out webPath);
                    }
                    catch
                    {
                        return;
                    }
        
                    string connectionString;
                    try
                    {
                        GetServiceInfo(servicePath, out connectionString);
                    }
                    catch
                    {
                        return;
                    }
        
                    StopService("INEDOOTTERSVC");
                    StopService("INEDOOTTERWEBSVC");
        
                    RunProcess(Path.Combine(servicePath, "Otter.Service.exe"), "uninstall");
                    RunProcess(Path.Combine(servicePath, "Otter.Service.exe"), "uninstallweb");
        
                    try { IIS.Current.DeleteWebSite("Otter"); }
                    catch { }
        
                    try { IIS.Current.DeleteAppPool("OtterAppPool"); }
                    catch { }
        
                    Thread.Sleep(5000);
        
                    DeleteDirectory(webPath);
                    DeleteDirectory(servicePath);
        
                    if (options.DeleteDatabase && !string.IsNullOrWhiteSpace(connectionString))
                    {
                        try
                        {
                            var connStringBuilder = new SqlConnectionStringBuilder(connectionString);
                            var dbName = connStringBuilder.InitialCatalog;
                            if (!string.IsNullOrWhiteSpace(dbName))
                            {
                                connStringBuilder.InitialCatalog = string.Empty;
        
                                using (var conn = new SqlConnection(connStringBuilder.ToString()))
                                {
                                    conn.Open();
        
                                    using (var cmd = new SqlCommand(string.Format("DROP DATABASE [{0}]", dbName), conn))
                                    {
                                        cmd.ExecuteNonQuery();
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
        
                    Registry.LocalMachine.DeleteSubKeyTree(@"SOFTWARE\Inedo\Otter", false);
                    Registry.LocalMachine.DeleteSubKeyTree(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InedoOtter", false);
                    DeleteDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu), @"Inedo\Otter"));
                    try { Directory.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu), "Inedo"), false); }
                    catch { }
        
                    FinishUninstall();
                }
        
                private static void GetRegistryInfo(out string servicePath, out string webPath)
                {
                    using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Inedo\Otter", false))
                    {
                        servicePath = (string)key.GetValue("ServicePath");
                        webPath = (string)key.GetValue("WebPath");
                    }
                }
                private static void GetServiceInfo(string servicePath, out string connectionString)
                {
                    var xdoc = XDocument.Load(Path.Combine(servicePath, "Otter.Service.exe.config"));
        
                    connectionString = xdoc
                        .Element("configuration")
                        .Element("appSettings")
                        .Elements("add")
                        .Where(s => (string)s.Attribute("key") == "InedoLib.DbConnectionString")
                        .Select(s => (string)s.Attribute("value"))
                        .First();
                }
        
        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post
        Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation