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?

2 Answers 2


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.

  • Thanks for taking the time to help me. I tried what you suggested but didn't have any luck. Any other ideas?
    – Burt
    Commented Oct 27, 2011 at 10:15
  • Can you open User profile app with that user via Central Admin UI? Is there anything else interesting in ULS logs? Commented Oct 27, 2011 at 11:33
  • 1
    It didn't work right away after the permission changes, but after waiting a couple minutes it started working for me.
    – thm51mb
    Commented Apr 1, 2016 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.
  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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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