0

I wrote an In/Uninstaller for a custom installation for MongoDb.
My way to install the mongoDB ist the following.

private Process GetInstallMongoProcess() {
  Log("Installing MongoDB Version 3.4.10 ...");
  Process installProcess = new Process();
  installProcess.StartInfo = new ProcessStartInfo("msiexec.exe", $@"/q /Lie {Constants.LogFileName} /i mongodb-win32-x86_64-2008plus-ssl-3.4.10-signed.msi INSTALLLOCATION=""{Constants.Path}3.4\"" ADDLOCAL=""all""");
  installProcess.OutputDataReceived += OnInstallProcessDataReceived;
  installProcess.Start();

  return installProcess;
}

But then I need to check of this Application is installed. The way I do is

private bool CheckIfAlreadyInstalled()
  {
  string[] registryKeys = { @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" };
  bool appIsInstalled = false;

  foreach (string registryKey in registryKeys) {
    RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey);
    if (key != null) {
      List<string> listOfInstalledApplications = key.GetSubKeyNames().ToList();
      appIsInstalled = listOfInstalledApplications.Contains(ApplicationGuid);
    }
  }

  if (appIsInstalled) {
    Log("MongoDB is already installed");
  }

  return appIsInstalled;
}

I can't find my installed application. Neither the name nor the ApplicationGuid.
I get about 300 entries, but the entry I need is not present, but I can See the installed Software in Regedit.exe

Do I am searching in wrong node ??

feldeOne
  • 417
  • 3
  • 18

0 Answers0