Fix it now
Error 1642 is ERROR_PATCH_TARGET_NOT_FOUND: Windows Installer will not apply the patch because the build it targets is not the one installed. Exchange security updates are built against one specific cumulative update, so the fix is to get the server onto that CU first, or to fetch the update built for the CU you are running.
Get-Command Exsetup.exe | ForEach-Object {$_.FileVersionInfo}
Get-ExchangeServer | Format-List Name,Edition,AdminDisplayVersion
- Compare the FileVersion from the first command with the build the security update names on its download page. They have to match, not be close.
- If the server is behind, install the cumulative update the security update targets:
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /Mode:Upgradefrom an elevated Command Prompt. - Then apply the security update, also from an elevated Command Prompt, by typing the full path to the .msp file. Do not double-click it.
- If the package will not open at all rather than refusing the build, that is 1635 or 1636: redownload it, unblock it with
Unblock-File, and run it from local disk rather than a share. - If no newer package exists for your version, no file will fit. That is a support-lifecycle problem and the last section deals with it.
Microsoft’s guidance is explicit that a cumulative update is installed from an elevated command prompt, and that database availability group members go into maintenance mode first.
If the update applies and the services come back, you are finished. If it refuses again, the next section explains what the installer is checking.
Why it happens
A security update for Exchange is a patch package, and a patch modifies known files belonging to a specific product at a specific version. Windows Installer compares what is registered on the machine with what the package expects and, where they do not correspond, refuses rather than writing files into a build they were never compiled against. Microsoft’s published text for 1642 says it plainly: the program being upgraded may be missing, or the upgrade patch updates a different version of the program.
0x8007066A is the same thing in a different dress. 0x066A is 1642, carried in an HRESULT with the Win32 facility 0x8007, so anything that reports the HRESULT is reporting the installer code. There is nothing extra to diagnose when you see it.
This is why the order is always the cumulative update first and the security update second, and why a package that installed cleanly on one server refuses on its neighbour that is one CU behind. A mixed estate turns every patch cycle into a per-server investigation, which is the real cost of letting builds drift apart.
Errors 1635 and 1636 describe a different failure and should not be chased the same way. 1635 is ERROR_PATCH_PACKAGE_OPEN_FAILED, published as the package not being able to be opened – verify that it exists and is accessible. 1636 is ERROR_PATCH_PACKAGE_INVALID: the file opened and is not a valid Windows Installer patch package. Both are file problems. Hunting build numbers will not fix a truncated download, and redownloading will not fix a build mismatch.
The server is behind the cumulative update the patch targets
You have this one if The FileVersion from Get-Command Exsetup.exe is lower than the build the security update names.
- Put database availability group members into maintenance mode before you start.
- Install the cumulative update the security update was built for, using
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /Mode:Upgradefrom an elevated Command Prompt. - Reboot, confirm services are running with
Test-ServiceHealth, and confirm mail is flowing. - Apply the security update, then bring the rest of the estate to the same build so the next cycle is one decision instead of several.
Cumulative updates include their predecessors, so you move to the target build directly rather than stepping through. Check whether the target build needs a fresh directory preparation before you begin.
The update was run without elevation, and the server is now inconsistent
You have this one if An earlier attempt appeared to run. Since then OWA returns a generic error or the admin centre reports it cannot load Microsoft.Exchange.Common.
- Reinstall the same .msp from an elevated Command Prompt by typing its full path, then restart the server.
- If the admin centre still fails, open IIS Manager, go to the Exchange Back End site, the ECP virtual directory, Application Settings, and replace the environment-variable paths in BinSearchFolders with absolute paths.
- From an elevated Exchange Management Shell in the Exchange Bin folder, run
.\UpdateCas.ps1and then.\UpdateConfigFiles.ps1. - Run
iisresetfrom an elevated Command Prompt and restart the server.
This is Microsoft’s documented repair for a security update installed without elevated permissions on a server with User Account Control enabled. It is far more common than people expect.
The package is for a different Exchange version
You have this one if 1636, or a mismatch that no cumulative update resolves because the file was never meant for this product.
- Establish the version as well as the build:
Get-ExchangeServer | Format-List Name,Edition,AdminDisplayVersion. - Download the package built for that version. Security updates are never cross-version.
- Check the language and architecture where the download page offers a choice.
- Verify the file size against the download page before running it again.
The file is damaged, blocked or on an unreachable path
You have this one if 1635, or the package refuses to open at all rather than complaining about the build.
- Redownload it and copy it to a local disk. Running a patch from a share is a recurring source of this.
- Unblock it:
Unblock-File -Path C:\Updates\<file>.msp, or clear the block from the file’s properties. - Run it from an elevated Command Prompt so you can read what it writes, rather than double-clicking it.
- If it still will not open, the download is bad. Get it again from Microsoft rather than from a copy someone kept.
Full reference
Matching the code to the situation
| Code | Published meaning | Where to work |
|---|---|---|
1642 / 0x8007066A |
ERROR_PATCH_TARGET_NOT_FOUND: the program being upgraded may be missing, or the patch updates a different version | Build level. Install the CU the update targets |
1635 |
ERROR_PATCH_PACKAGE_OPEN_FAILED: verify that the patch package exists and is accessible | The file and where it is stored |
1636 |
ERROR_PATCH_PACKAGE_INVALID: not a valid Windows Installer patch package | The file itself, or the wrong product entirely |
Establishing the build without guessing
Microsoft documents two ways to read the installed build. Get-Command Exsetup.exe | ForEach-Object {$_.FileVersionInfo} gives the full build including security and hotfix updates. Get-ExchangeServer | Format-List Name,Edition,AdminDisplayVersion gives the cumulative update level only, which is enough to answer the 1642 question but will not tell you whether a security update has already gone on.
Record both, for every server, before you start a patch round. The most expensive part of this error is not the failed install; it is discovering halfway through a maintenance window that three servers are on three different builds.
Installing the cumulative update properly
- Put database availability group members into maintenance mode first, following Microsoft’s DAG maintenance procedure.
- Open an elevated Command Prompt. Microsoft states this as a best practice rather than an option.
- Run
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /Mode:Upgrade, adding/DomainController:<ServerFQDN>if you want the run pinned to one controller. - Let the readiness checks complete. Errors can be fixed and retried in place; if a fix requires a restart, setup has to be started again from the beginning.
- Reboot, take the server out of maintenance mode, and only then apply the security update.
When no package fits at all
There is a version of this problem that no file and no command will resolve. If the server runs an Exchange version that has left support there is no security update built for it, and none will be written. Microsoft’s lifecycle pages put the end of extended support for both Exchange Server 2016 and Exchange Server 2019 in October 2025. An internet-facing mail server with no route to security updates is a live risk rather than a tidiness problem, and 1642 on such a server is the symptom, not the disease.
Confirming the server is whole afterwards
Test-ServiceHealthreports no missing required services for the installed roles.C:\ExchangeSetupLogs\ExchangeSetup.logends in success rather than a rollback.- The build reported by
Get-Command Exsetup.exeis the one you intended, including the security update. - OWA and the admin centre both open, which is the quickest check that the web applications survived the patch.
- Mail flows in both directions on a test message rather than on the queue viewer’s opinion.
When a licence is the actual fix
The purchase question only arises in one situation, and it is worth being precise about it. If your Exchange version is still in support, install the cumulative update the security update targets and 1642 disappears at no cost; nothing on this page needs a licence. If the version has left support there is no package to install at any price, because Microsoft has stopped building them. Exchange Server 2016 and Exchange Server 2019 both reached the end of extended support in October 2025, and the supported destination is Exchange Server Subscription Edition. Microsoft licenses it on the familiar model: a server licence for each running instance, with Standard supporting 1 to 5 mailbox databases and Enterprise 1 to 100, plus a Client Access Licence for each user or device, where the Enterprise CAL is an add-on to the Standard CAL rather than a replacement for it. Arco supplies Exchange Server SE Standard and the matching CALs, and can work out which server edition your database count actually needs before you commit.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
1642 |
ERROR_PATCH_TARGET_NOT_FOUND: the installer cannot apply the patch because the program being upgraded is missing or the patch updates a different version | Microsoft Learn |
0x8007066A |
Win32 error 1642 carried as an HRESULT. The same refusal, reported by something that prints HRESULTs | Microsoft Learn |
1635 |
ERROR_PATCH_PACKAGE_OPEN_FAILED: the patch package could not be opened; verify it exists and is accessible | Microsoft Learn |
1636 |
ERROR_PATCH_PACKAGE_INVALID: the file is not a valid Windows Installer patch package | Microsoft Learn |
Confirm the fix worked
Get-Command Exsetup.exe | ForEach-Object {$_.FileVersionInfo}reports the build you intended, including the security update.Test-ServiceHealthshows every required service running for the roles installed.C:\ExchangeSetupLogs\ExchangeSetup.logends in success, not a rollback.- OWA and the Exchange admin centre both load for a test mailbox.
- A message sent in and a message sent out both arrive.
Questions people ask about this
Do I have to buy anything to fix 1642?
On a supported version, no. Install the cumulative update the security update targets and the patch applies. Buying only enters the conversation on a version that no longer receives updates, because there is then no patch to install at any price.
Can I skip cumulative updates and go straight to the newest?
Cumulative updates include their predecessors, so you move to the target build directly. What you cannot skip is any directory preparation the newer build requires, so check that before the maintenance window rather than during it.
Why did the update fail after appearing to work?
Check whether it was run without elevation. Microsoft documents that installing an Exchange security update without elevated permissions leaves files and configuration inconsistent, with OWA returning a generic error and the admin centre unable to load an assembly. The repair is to reinstall it elevated and run UpdateCas.ps1 and UpdateConfigFiles.ps1.
Is it safe to run an unsupported Exchange server behind a firewall?
Less exposed is not the same as safe. A firewall does not help against a compromised client or an authenticated user, and unpatched Exchange servers have been a routine way into organisations. Treat it as an outstanding risk with a date attached rather than a settled arrangement.
What does Exchange Server SE licensing involve?
A server licence for each running instance and a Client Access Licence for each user or device. Microsoft states that Standard supports 1 to 5 mailbox databases and Enterprise 1 to 100, and that the Enterprise CAL is an add-on requiring a Standard CAL as well.
