In this post, we will be fixing “Microsoft SharePoint Server 2016 encountered an error during setup” that you may face when installing SharePoint 2016 on Virtual Machine or Hyper-V.
You might also like to read SharePoint 2013 setup unable to proceed: This Product Requires Microsoft .Net Framework 4.5
I have tried to install SharePoint 2016 on Windows Server 2016 using Hyper-V Manager, but I got the below error:
Microsoft SharePoint Server 2016 encountered an error during setup
I also have tried to install SharePoint 2013 on Windows Server 2012 R2, I got the same error
Microsoft SharePoint Server 2013 encountered an error during setup

Cause
When installing SharePoint on Hyper-V, you might get “Microsoft SharePoint Server 2016 encountered an error during setup” error because, By default, Hyper-V settings for the virtual processor’s numbers is one virtual processor, and to be able to install SharePoint the virtual processor’s setting must be more than one virtual processor to can install it properly.

If you already have set the number of the virtual processors to be greater than 1 and you still getting the “Microsoft SharePoint Server 2016 encountered an error during setup” that means the logging and debug entry are not added in the Registry settings under this path “HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer”
Based on the Host CPU capabilities, the virtual processor’s number must be set to be more than one virtual processor to can install SharePoint on any kind of Virtual Machine whatever it’s a Hyper-V or VMware.

Steps
- Go to Hyper-V Manager Home Page.
- Select the SharePoint VM > From Right side > Below Actions > Click on Settings.

- From left side > Below Hardware,> Click On Processor to check the number of virtual processors.
Note: You must shut down the SharePoint VM to can edit the Hardware Settings, otherwise, you will get the settings disabled as shown below:

- Based on Host CPU capabilities, set the number of virtual processors that must be more than one virtual processor.

- Run the VM, try to install SharePoint again that should now be installed properly.

In case, you are using VMware instead of Hyper-V, you can also change the number of virtual processors by doing the following:
Steps
- Make sure that the VM status is stopped to can edit its settings.
- Go to Vmware Home Page > Edit Virtual machine settings.

- In Hardware Tab > Click on the Processors.
- Based on the CPU capabilities, set the number of processors and the core per processors that must be more than one processor.

- Run the VM, try to install SharePoint again that should now be installed properly.

If the above solution doesn’t solve this issue and you still getting “Microsoft SharePoint Server 2016 encountered an error during setup“, and the number of virtual processors is not set to 1, so you will need to run the below PowerShell script provided by Luis Valencia.
- Open Windows PowerShell as Administrator.

- Run the below script.
if(!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer)){
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer | Out-Null
}
$regProps = Get-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer
if(! $regProps.logging){
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer -Name logging -Value voicewarmup -PropertyType String | Out-Null
}
if(! $regProps.debug){
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer -Name debug -Value 3 -PropertyType DWord | Out-Null
}
Applies To
- SharePoint 2016.
- SharePoint 2013.