SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am making the following call

    new-object Microsoft.Office.Server.UserProfiles.UserProfileConfigmanager($servercontext)

And get the following error:

New-Object : Exception calling ".ctor" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Users\Administrator\AppData\Local\Temp\1\6ff1f5cc-8ca6-44b8-a721-41f7c8042848.ps1:24 char:13
+         new-object <<<<  Microsoft.Office.Server.UserProfiles.UserProfileConfigmanager($servercontext)
+ CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Can anyone help please?

share|improve this question
up vote 11 down vote accepted

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.

share|improve this answer
    
Thanks for taking the time to help me. I tried what you suggested but didn't have any luck. Any other ideas? – Burt Oct 27 '11 at 10:15
    
Can you open User profile app with that user via Central Admin UI? Is there anything else interesting in ULS logs? – Toni Frankola Oct 27 '11 at 11:33
    
It didn't work right away after the permission changes, but after waiting a couple minutes it started working for me. – thm51mb Apr 1 at 16:35

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.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.