none
profile.CreatePersonalSite() - > User cannot be found error

    Question

  • Hi ,

    I am trying to execute pre-provisioning of personal sites using a powershell script .

    I was getting "Access Denied Errors " when I was executing the script under a farm admin log in .

    I am now executing the script under "Farm Account" but I am getting " User cannot be Found" error on $profile.CreatePersonalSite() command

    I have checked the permissions and the farm account has full permissions in the User Profile Sevice Application.

    I am not sure why the error is popping up.

    Any pointers or solution will be much appreciated.

    Thanks,

    Shilpa

    Wednesday, July 24, 2013 8:10 PM

Answers

  • Hi shilpa835,

    Please use the following code to create.

    public static void CreatePersonalSite(string sAccount)
    {
    using (SPSite site = new SPSite(“http://moss”))
    {
    ServerContext context = ServerContext.GetContext(site);
    UserProfileManager profileManager = new UserProfileManager(context);
    UserProfile u = profileManager.GetUserProfile(sAccount);
    u.CreatePersonalSite();
    }
    }

    Thanks,

    Jack


    Jack Gao
    TechNet Community Support

    Sunday, July 28, 2013 10:15 AM

All replies

  • Hi Shilpa,

    Try the following steps -

    1) Check if the account has full access on the content db and web app which hosts My Sites. Basically, Add your account as a shell admin for the content db of mysite web app.

    2) You might have checked this earlier, but just to confirm - select your user profile service app in Central Admin and click on "Permissions" button on ribbon. Make sure your current account is present there and has full control privileges.

    3) Very silly - But make sure you have opened powershell with "Run as Administrator" privileges.

    Narahari

    ******If a post answers/helps your question, please click "Mark As Answer" on that post and/or "Vote as Helpful*******
    Thursday, July 25, 2013 2:14 AM
  • Hi Narhari,

    Thanks for the suggestions.

    I checked all the permissions and also asked our SharePoint Admin to have a look .

    All the permissions seems to be in place and the Farm account has all the permissions listed above.

    I am also using the powershell under the Administrator login ( opened as "Run as Administrator" ).

    Are there any permissions that need to be further checked.

    Thursday, July 25, 2013 2:53 PM
  • Hi shilpa835,

    Did you allow the users to create personal sites? For a user to create their own sites self-service site creation should be enabled.

    Go to Application management-> self service site creation-> In that select the right web application-> select the correct web application and select "On"

    Thanks,

    Jack


    Jack Gao
    TechNet Community Support

    Friday, July 26, 2013 7:43 AM
  • Hi Jack,

    The Users are able to create the sites but the powershell command is giving error .

    Thanks,

    Shilpa

    Friday, July 26, 2013 1:36 PM
  • Hi shilpa835,

    Please use the following code to create.

    public static void CreatePersonalSite(string sAccount)
    {
    using (SPSite site = new SPSite(“http://moss”))
    {
    ServerContext context = ServerContext.GetContext(site);
    UserProfileManager profileManager = new UserProfileManager(context);
    UserProfile u = profileManager.GetUserProfile(sAccount);
    u.CreatePersonalSite();
    }
    }

    Thanks,

    Jack


    Jack Gao
    TechNet Community Support

    Sunday, July 28, 2013 10:15 AM
  • Thanks Jack . I will use the code you have pasted.

    Currently I am using the code below

    $mysiteHostUrl = "http://atel-vm-9.ucdenver.pvt:8080/"
    $mysite = Get-SPSite $mysiteHostUrl 
    $context = [Microsoft.Office.Server.ServerContext]::GetContext($mysite)
    $upm =  New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) 
    $profile = $upm.GetUserProfile("university\salbrecht");
    $profile.CreatePersonalSite()

    Monday, July 29, 2013 1:57 PM