There are a couple of things we could look for in this solution.
This error generally occurs when Windows Installer cache files (C: Windows Installer) are missing / corrupted. To further isolate the problem, you can try running ROISCAN on the machine and see how many installer cache files are missing. If these cache files were manually removed during any maintenance, it would be very difficult to restore the files. However, if you have some other working environment (test / trial), you can copy the installer cache files and rename them according to the unique revision number of the associated registry keys. Fortunately, I was able to find a PowerShell script made by Ahmad Adel Gad here, which will do this task for you. You simply have to:
Download the script.
Copy the script to the destination machine.
Make sure the current local identity has read / write permission on the "C: Windows Installer" folder on the target machine and read permission on the source folder (if the source is a machine name, make sure have read permission on the local folder "C: Windows Installer" inside the source machine).
Run the script locally on the target machine with the following parameters as illustrated by the following examples.
. Restore-InstallerFiles.ps1 -SourceMachine "Machine1", "Machine2", "Machine3";
. Restore-InstallerFiles.ps1 -SourceFolder "D: InstallerFiles", "E: InstallerFiles", " MachineX D $ MSI Files";
. Restore-InstallerFiles.ps1 -SourceFolder "D: InstallerFiles", "E: InstallerFiles", "D: InstallerFiles2" -LogFile "D: Log.txt";
Source of the previous solution:
"An error occurred while running detection" Update for Sp2013 SP1
Try to download the patches one more time, there is a small chance that the downloaded files have become corrupted.
Here are some detailed steps to fix this problem:
An error occurred while running discovery when patching SharePoint servers
In general, if we go this way c: windows installer folder: we could see that this path could have been damaged or files are missing.
Copy the c: windows installer folder from another working SharePoint server to a local c: temp folder on your faulty server.
Follow the steps below:
Copy the above script into a file. I suggest using a text editor like Notepad ++ instead of a regular notepad. I tried copying the code in Notepad and got errors because Notepad reads certain characters as ASCII characters, so when you try to run it as a .vbs script it returns error: unknown characters. Or you can download it from me: OpUtil.txt. Open it, watch it if you like, but be sure to rename it as a .vbs file instead of a .txt. Also put this script in your c: temp folder for organization.
Open command prompt on your wrong server. Navigate to c: windows installer and run the following command:
runas / user: DOMAIN Admin_Account "cscript.exe c: temp OpUtil.vbs / RepairCache / srestorelocation = c: temp "
Open a PowerShell window and run Get-SPProduct -local to update the farm configuration database.
Run psconfig.exe to update everything and you should now be ready to install your updates.
The previous solution is:
An error occurred while running discovery.