Sharepoint - Powershell error when trying to hook into UserProfileConfigManager

This is usually a permissions issue, the user running this code should be added to the User Profile service both as an Admin and Permissions.


I had the same issue. But I solved it as Toni Frankola said. May be you did wrong steps to add permissions to the user profile service. Look at this post to be sure that you added these permissions correctly.

Relevant steps from the above link:

  1. Open the SharePoint 2010 Central Administration page, and then click Manage Service Applications.
  2. Select the row for the User Profile Service application. Instead of clicking the name, select the row to highlight it.
  3. On the Service Applications tab, click Permissions.
  4. In the Connection Permissions for User Profile Service Application dialog box, add the user or group that needs permission to run impersonation applications. After you click Add, and the user name shows in the list of claims, select the added user in the list and then select the Full Control check box. Otherwise, the user is not added when you click OK. Full Control is the only option.
  5. To ensure that the user or group is added, reopen the Connection Permissions for User Profile Service Application dialog box and confirm that the new user or group displays in the list of claims.
  1. Go to "Services on Server," select the server you're on, then stop the User Profile Service. Once it's stopped, start it again. That's when I stopped getting the error.