We had a server with Server 2008 R2 on it. It used to be a certificate authority on the domain. We removed this role from the server, restarted a few times and then did an in-place upgrade on this server to 2012 R2. When the server came back online the CA role had returned but shows in a failed state.
We ran sfc /scannow and it reports no issues.
If we try to remove the role with server manager or via powershell with Remove-WindowsFeature -Name AD-Certificate we get the error:
"A prerequisite check for the AD-Certificate feature failed. 1. The status of the role services on the target machine could not be determined. Please retry. The error is The term 'Get-InternalAdcsConfigurationState' is not recognized as the name of a cmdlet."