Michael Schau

My SharePoint Blog

User Profile Service

Many have had problems provisioning the User Profile Service in SharePoint 2010, including myself.

My Powershell script failed and afterwards trying to manually create a User Profile Service Application in CA, I got the following error

An object of the type Microsoft.Office.Server.ActivityFeed.ActivityFeedUPAJob named "User Profile Service Application_ActivityFeedJob" already exists under the parent Microsoft.Office.Server.Administration.UserProfileService named "".  Rename your object or delete the existing object.

Sounds like a Timer Job, so I wanted to take a look at the job definitions.

TimerJobDefinitions

But now I got a "Operation is not valid due to the current state of the object".

OK, so I clearly needed to cleanup the Timer Jobs related to the User Profile Service. To do that I executed the following Powershell command.

Get-SPTimerJob | where {$_.name -match "User Profile Service*"} |  % { $_.Delete()}

Now I was able to both review the job definitions and provision the User Profile Service Application successfully.