Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Access denied error when creating personal site

$
0
0
HI

I am trying to create my sites  using powershell or console for user profile but it always throw access denied exception.My site is in port 80 and the code is as follows:

$upm.GetEnumerator() | ? {$_.ProfileType -eq "User" } | foreach-object{
  
    $profile = $upm.GetUserProfile($($_.Item("AccountName")))
    if($profile.PersonalSite -eq $Null)
    {
    Write-Host Creating pwersonal site for $($_.Item("AccountName"))-ForegroundColor Blue
    $profile.CreatePersonalSite();
     Write-Host  personal site Created for $($_.Item("AccountName"))-ForegroundColor Cyan
    }
 
  }


When I log in as the user and create site from UI then I am able to create my site but when I use powershell to create for everyone it throws access denied.

AppPool is running with  user1 account while I am login as administrator.I am the site administrator.I have tried all ways but it is not working. Selfservice site creation is enabled.I have added the users in webapplications users policy and given full permissions.They are added in user profile as full control but still I am getting the error.tried with run with elevated privilege but no use.

Any idea how to resolve this?

Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>