Illegal operation attempted on a registry key marked for deletion

Came across this yesterday and had me stumped for a couple of hours. I have a simple SharePoint web part that calls a web services on another server that gets AD details for a user. The part has been working fine for a number of months and all of a sudden throws the error when calling the web service:

Illegal operation attempted on a registry key marked for deletion

The only change made was that we renamed the server where the service is hosted, although that was about a month ago and the service endpoints were all changed and worked fine. It seems that the OS does get a bit confused with the profile when you change the server name (well, eventually). Easy fix though:

  • Login to server with the account that the web service runs under
  • Open the group policy editor (gpedit.msc)
  • Go to Computer Configuration->Administrative Templates->System-> UserProfiles-> Do not forcefully unload the user registry at user logoff.
  • Change the setting from “Not Configured” to “Enabled”, which disables the new User Profile Service feature.

None of the posts I found required a restart of the server, however the fix only worked for me after I restarted…but let’s be honest anything Microsoft works better after a restart

Leave a Reply

Your email address will not be published. Required fields are marked *