Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

2 Answers 2

up vote 9 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

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.

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.