When setting the MySiteHostUrl I get a UserProfileApplicationNotAvailableException

When I’m trying to set the MySiteHostUrl via PowerShell it throws an error. Taking a closer look it seems after initializing the UserProfileManager class an UserProfileApplicationNotAvailableException is raised.

The exception you receive is

New-Object : Exception calling ".ctor" with "1" argument(s): "UserProfileApplicationNotAvailableException_Logging :: UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does not have 458839b6-4979-413a-a7a3-41d8564faea3"

The PowerShell script I’m using is retrieving the current context and initializing the UserProfileManager object. This should provide me access to the MySiteHostUrl.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ea 0 $site = Get-SPSite “http://my.contoso.com” $context = Get-SPServiceContext($site) $upm = New-Object -TypeName Microsoft.Office.Server.UserProfiles.UserProfileManager -ArgumentList $context $upm.MySiteHostURL = “http://my.contoso.com”

The solution to this is providing the account running the PowerShell script sharing permissions “Full Control” on the User Profile Service Application.

  • Open Central Administration
  • Click Service Applications
  • Select “User Profile Service Application”
  • Click in ribbon the Permissions button
  • Add account which is running PS script, in this example “xxx-spinstall”
  • Select “Full Control” and click OK
  • Run the PS-script again!

Permissions User Profile Application

Advertisements
Leave a comment

5 Comments

  1. Valdis Thomann

     /  April 2, 2014

    Thanks mate, very helpful 🙂

    Reply
  2. MP

     /  February 4, 2015

    Thanks. I was able to fix the picture problem in user profile (User Pictures from AD to SharePoint 2013) . I was unable to run the script and with the suggestion in this blog to use an account that has full control, I was able to run the script without error and pictures now show up.

    Reply
  3. Pål

     /  June 19, 2015

    I had to add the account running powershell to Administrators – adding only to Permissions tab was not sufficient

    Reply
    • Hi Pal, having the same issue, when you mentioned adding to Administrators – do you mean local administrators group on SP server?

      Reply
  4. Reblogged this on madhavan.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: