SQL Server 2008 R2 64bits repair error I had to reinstall the default server instance on one Windows 2008 R2 server.

I checked that the sql groups were cleaned and the registry keys cleaned before reinstalling.

After reinstalling, the sqlagent refused to start.

The only way to start the agent successfully was to add the agent user (domain user) to the group MSSQLUSER$&lt;SERVER_NAME&gt; $MSSQLSERVER

I attempted a repair. all the repair attempts failed with the following message:
 - and removed the user above from the SQL group.


  The following error has occurred:
  
  The process cannot access the file
  'C:\Windows\SysWOW64\perf-MSSQL10_50.MSSQLSERVER-sqlagtctr.dll'
  because it is being used by another process.
  
  Any further update fails due to the repair error (cumulative hotfix update 4).


The SQL server log shows the following:


  Error: 18456, Severity: 14, State: 11
  Login failed for user ''. Reason: Token-based server access validation failed with an infrastructure error. Check for previous
  errors. [CLIENT: ]


The user &lt;user&gt; is a domain user used both for the SQL Server database engine and SQL Server Agent services. The password never expires.

I tried to give the user SQL sysadmin rights, then Windows local admin rights without success. So I'm stuck. Looked over the web and didn't find any solution that match 

Also tried to : kill the wmi processes locking sql server agent, and stop wmi services (failed).

Any suggestion would be greatly appreciated.

Christophe
This is a known problem with this particular DLL during the repair process.  Copying and renaming the file seems to be a suggested work around - see:

http://connect.microsoft.com/SQLServer/feedback/details/576412/-the-process-cannot-access-the-file-c-windows-syswow64-perf-mssql10-50-mssqlserver-sqlagtctr-dll-because-it-is-being-used-by-another-process