Resolve “Application Server Role, Web Server (IIS) Role: Configuration Error”

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:

sharepoint

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:

  1. Add “GP Editor” Snapin in MMC.
  2. Then, go to Computer Configuration, Administrative Templates, then System.
  3. Update “Specify settings for optional” policy as Enabled.
  4. Update “Contact Windows Update” as selected.
  5. Click Apply.
  6. 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!