For some reasons, SharePoint 2013’s prerequisite installer can't find which server manager to use and fails installation of prerequisite files.
So, what you should do is: Go to Windows/System32, find servermanager.exe, duplicate it and then rename it to "servermanagercmd.exe".
After this, re-run prerequisite installer, it will work perfectly:
If it doesn’t work then you haven’t enabled downloading setup files remotely in MMC (group policy editor) settings.
To do this, follow the below given steps:
- Add “GP Editor” Snapin in MMC.
- Then, go to Computer Configuration, Administrative Templates, then System.
- Update “Specify settings for optional” policy as Enabled.
- Update “Contact Windows Update” as selected.
- Click Apply.
- Make sure IIS Admin Service also works in Server Manager.
It should download all required prerequisites and enable roles before installing SharePoint 2013 on Windows Server 2012.
That's it!