During configuration of some Server 2008 R2 VMs for a test lab, I kept getting the error:
At first I thought it was related to a recent patch, but on rebuilding the VM without patches and with "windows updates" disabled the error had returned.
I've seen lots of posts on other blogs about this, but none provided a solution that worked. I tried repairing the service packages, msi installer and dotnet - but none of these resolved the issue.
I finally resolved the issue by first disabling McAfee antivirus (disabled "Access Protection" and "On-Access Scanner"). Once disabled I could add the Directory Services role and add the server to the domain.