0

I have to access a User Profile application for user profile manipulation by PowerShell.

Environment:

I have two user profile service applications installed in my farm.

I wrote this code:

$site = new-object Microsoft.SharePoint.SPSite("http://XXXXXX/_layouts/15/ManageUserProfileServiceApplication.aspx?&ApplicationID=XXXXXXX   GUID   XXXXXXXXXX); 
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site); 
$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)  

The problem is that this code always points to the same (the first created) User Profile Service application.

I changed the GUID to point to the second User Profile application but it still points to the firts one. How can I reach the second one?

  • Thanks for the comments, I am really struggling on it. I am already using the service context but it always point to the first created user profile. Actually I am setting-up two user profile one on windows authentication and other one with claim base authentication. when I get UserProfileManager from serviced Context it always point to first created profile. the link you provided is also do the same. – Adnan May 25 '15 at 20:46
0

I worked more and figure-out the problem myself.

if we are creating two user profile application services within the same farm, we have to create a different proxy group in order then it wont point to the same user profile.

Creation of Separate Group Application Management -> Configure Service application association.

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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