Solution:
On a clean install of Windows 2012 R2
https://social.technet.microsoft.com/Forums/office/en-US/37cc20db-6cc7-45e0-928c-9a1ddbdab2ae/the-tool-was-unable-to-install-application-server-role-web-server-iis-role?forum=sharepointadmin
I copied and then renamed, this also fixed my issue. "rename the file C:\windows\System32\ServerManager.exe with ServerManagerCMD.exe"
Comments: ** Comment from web user: SpRambler **
On a clean install of Windows 2012 R2
https://social.technet.microsoft.com/Forums/office/en-US/37cc20db-6cc7-45e0-928c-9a1ddbdab2ae/the-tool-was-unable-to-install-application-server-role-web-server-iis-role?forum=sharepointadmin
I copied and then renamed, this also fixed my issue. "rename the file C:\windows\System32\ServerManager.exe with ServerManagerCMD.exe"
Comments: ** Comment from web user: SpRambler **
just to avoid a null value error here:
$Process= Get-Process | Where-Object {$_.name -like 'servermanagercmd'} -ErrorAction SilentlyContinue
if {$process -ne $null}
(
$Process.CloseMainWindow()
)