What in the User Profile Service Application is going on here?

While working with PowerShell to build out Service Applications, I managed to get my test farm into a state where I no longer had a User Profile Service Application, but the user profile timer jobs were still around. 

Trying to create a new User Profile Service Application would result in the following :

New-SPProfileServiceApplication : An object of the type Microsoft.Office.Server.ActivityFeed.ActivityFeedUPAJob named "User Profiles_ActivityFeedJob" already exists under the parent Microsoft.Office.Server.Administration.UserProfileService named "".  Rename your object or delete the existing object.
At line:1 char:32

+ New-SPProfileServiceApplication <<<<  -Name "User Profiles" -ApplicationPool (Get-SPServiceApplicationPool "SharePoint Services Default") -ProfileDBName "UserProfile_Profiles" -ProfileDBServer "Jorman-SQL-02" -ProfileSyncDBName "UserProfile_Sync" -ProfileSyncDBServer "Jorman-SQL-02" -SocialDBName "UserProfile_Social" -SocialDBServer "Jorman-SQL-02"

+ CategoryInfo          : InvalidData: (Microsoft.Offic...viceApplication:SPCmdletNewProfileServiceApplication) [New-SPProfileServiceApplication], SPDuplicateObjectException

+ FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.SPCmdletNewProfileServiceApplication


Trying to get to the Timer Job Definition page in Central Admin would return the following error.  Entry is from the SharePoint trace logs, but the message was displayed in the popup dialog on the page.  Notice in the stack, that we’re getting the UserProfileApplicationJob when the exception is thrown.

2/08/2011 19:36:41.02     w3wp.exe (0x1AE0)                           0x0E18    SharePoint Foundation             Runtime                           tkau    Unexpected   

System.InvalidOperationException: Operation is not valid due to the current state of the object.   

at Microsoft.Office.Server.Administration.UserProfileApplicationJob.get_UserProfileApplication()    

at Microsoft.Office.Server.Administration.UserProfileApplicationJob.get_DisplayName()    

at Microsoft.SharePoint.ApplicationPages.JobDefinitionsDataSourceView.AddRow(SPJobDefinition jd, DataTable table, DataSourceSelectArguments selectArguments)    

at Microsoft.SharePoint.ApplicationPages.JobDefinitionsDataSourceView.AddService(SPService service, DataTable table, DataSourceSelectArguments selectArguments)    

at Microsoft.SharePoint.ApplicationPages.JobDefinitionsDataSourceView.AddFarm(SPFarm farm, DataTable table, DataSourceSelectArguments selectArguments)    

at Microsoft.SharePoint.WebControls.TimerJobDataSourceView.FillDataTable(DataTable table, DataSourceSelectArguments selectArguments)    

at Microsoft.SharePoint.WebControls.DataTableDataSourceView.Select(DataSourceSelectArguments selectArguments)    

at Microsoft.SharePoint.WebControls.AdministrationDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)    

at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)    

at System.Web.UI.WebControls.DataBoundControl.PerformSelect()     at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()    

at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()     at System.Web.UI.Control.EnsureChildControls()   

At this point, I need to delete some Timer Job Definitions, but I can’t get to Job Definition page in Central Admin to see what jobs are still in the configuration.  This left me going back to PowerShell to do the cleanup.  I started with running Get-SPTimerJob.  This dumps out all the job definitions in the configuration.  I could see the “User Profiles_ActivityFeedJob” definition mentioned in my PowerShell error.  I also noticed there were 9 other Timer Jobs that started with “User Profiles”.  In order to delete them all, I ran the following :

get-sptimerjob | where {$_.Name -match "User Profile"} | %{$_.Delete()}

This grabs all the Timer Jobs that have a name like “User Profile”, then calls Delete on the definition.  Once I ran the above, I was able to provision my User Profile Service Application as well as get back into the Review Job Definitions page in Central Admin.

Comments (9)
  1. Robert Boström says:

    This article solved my problem, thanks a lot!

  2. AllenWang says:

    My exact problem, exact error message and absolutely the right soltuion.

    Thanks for sharing.

  3. Dhyan says:

    I'm not able to delete the corrupted UPS, its status is showing as "Stopping" all the time and I have tried the Powershell console also it just freezes.  Give me some pointer what i'm missing.

  4. Jerry_Orman says:

    You can only start a service that is in the Stopped stated. You'll need to get the service stopped, before you try starting it again. This forum post has some suggestions on getting the service instance to show stopped.


  5. Jacob says:

    Thanks for your post. I am not sure why they leave job definitions when the service application is delete. Anyway, your post saved my day!

  6. I had exactly the same issue and thanks for sharing the solution!

    BTW nice post title 🙂

  7. DanTheManXX says:

    The original error can be caused by attempting to set up 2013 UPA without Machine admin access as I have found out – creates the timer job but no UPA .

  8. Lele says:

    Thank you very much! Solved my problem as well.

  9. Guru says:

    Thank you very much! Solved my problem as well

Comments are closed.

Skip to main content