Error reinstalling ElasticSearch with msi


I uninstalled ES 7.2.0 for installing in other partition of my drive. When i try to reinstall, it pop-ups this error:

An ES_HOME environment variable exist but no previous installation was detected. The MSI does not support upgrading from a previous zip based deploy.

I tried to search the ES_HOME variable environment but didn't find it. I removed the ElasticSearch service manually.

Did you uninstall Elasticsearch 7.2.0 from the system, as well as removing the service?

Yes, as you can see, there's no elastic in any of the windows.

I tried uninstall now with the command line as the link you indicated, the log output:

MSI (s) (C0:9C) [10:20:09:420]: Product: Elasticsearch 7.2.0 -- Installation failed.

MSI (s) (C0:9C) [10:20:09:420]: Windows Installer installed the product. Product Name: Elasticsearch 7.2.0. Product Version: 7.2.0. Product Language: 1033. Manufacturer: Elastic. Installation success or error status: 1605.

This action is only valid for products that are currently installed.

What does the following show in a new PowerShell terminal



[System.Environment]::GetEnvironmentVariable("ES_HOME", "Machine")

It might also be worth killing any msiexec.exe processes running, before trying again

taskkill /f /im msiexec.exe



C:\Program Files\Elastic\Elasticsearch\7.2.0\
But this folder doesn't exist

[System.Environment]::GetEnvironmentVariable("ES_HOME", "Machine")
Returns nothing

OK, so there's an ES_HOME environment variable specified, but it's not a system environment variable, so it's either a user environment variable or a process environment variable. Both of these can be removed with the following PowerShell

foreach ($scope in @("User", "Process")) {
    [System.Environment]::SetEnvironmentVariable("ES_HOME", "", $scope)

Note that these changes won't be reflected in the current terminal until environment variables are refreshed from the registry. The easier way to check is to open a new terminal and check that ES_HOME environment variable no longer exists with


which should now not print anything. You can now try the install again. You may optionally also want to remove the data, config and logs directories from the previous installation, if you want to start completely clean. The default location for these is %ProgramData%\Elastic\Elasticsearch if using cmd, or $env:ProgramData\Elastic\Elasticsearch if using PowerShell.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.