Exchange 2013 Upgrade/Uninstall Fails at Search Foundation
When running Exchange 2013 setup — whether upgrading to a cumulative update or uninstalling — you may hit a failure at the “Uninstall Search Foundation for Exchange” step with this error:
Cannot determine the product name registry subkey, neither the
'RegistryProductName' application setting nor the
'CERES_REGISTRY_PRODUCT_NAME' environment variable was set.
Cause
During Exchange 2013 installation, setup should create a CERES_REGISTRY_PRODUCT_NAME user environment variable pointing to the Search Foundation component. If that variable is missing or was never set correctly, setup can’t locate the search engine and fails when it tries to remove it.
Fix
Set the variable in your current PowerShell session before re-running setup:
$env:CERES_REGISTRY_PRODUCT_NAME = "Search Foundation for Exchange"
Then run the Exchange installer again. Setup will find the variable and proceed through the Search Foundation step without issue.
Verifying environment variables
If you want to confirm the variable is set (or check what else might be missing), list all current environment variables:
Get-ChildItem env:
You can also set the variable persistently at the machine level if you need it to survive across sessions:
[System.Environment]::SetEnvironmentVariable(
'CERES_REGISTRY_PRODUCT_NAME',
'Search Foundation for Exchange',
'Machine'
)
Though for a one-off upgrade or uninstall, the session-level $env: approach is sufficient.