2

My solution contains Site Collection scope features and has been deployed to Site Collections that the farm administrator has not been granted any explicit permissions.

If the farm administrator tries to visit the site collection in the browser he sees an Access Denied error message.

The farm admin now needs to deploy an upgrade to my Solution.

He has successfully called the powershell cmdlet Update-SPSolution

when the farm admin calls SPContentDatabase.QueryFeatures("Site",$true) it returns the feature that needs to be upgraded in the site that he has no permissions to access.

However if the farm admin calls SPFeature.Upgrade($true) then an access denied error is thrown.

How is the site collection feature upgrade supposed to work?

Should the farm admin delegate site collection feature upgrade to the site collection owner?

Should the farm admin try to impersonate the site collection administrator?

Is there some user I can elevate to that is guaranteed to be able to call Upgrade on a site collection feature?

2
  • I found this link. social.technet.microsoft.com/Forums/en-GB/sharepointadmin/… It suggests to "take ownership" of the site collection. But this doesn't feel right to me.
    – Steve P
    Commented Oct 20, 2010 at 17:37
  • We found a way to elevate privileges enough that we can upgrade features in the site. I'm still not sure if we should elevate or delegate to the site collection admin. I'll leave it another week and see which answer gets the most votes.
    – Steve P
    Commented Oct 24, 2010 at 12:49

2 Answers 2

3

Farm Administrators do not by default have access to Site content.

Site collection feature upgrade and activation is normally delegated to the Site Collection Administrators (I think).

4
  • Is there some UI the Site Collection admin can use to upgrade the features?
    – Steve P
    Commented Oct 20, 2010 at 17:36
  • 1
    Unsure, but have a look at Chris O'Brien's SPFeatureUpgrade Kit on Codeplex: spfeatureupgrade.codeplex.com
    – James Love
    Commented Oct 20, 2010 at 18:25
  • I wish I could double plus up vote thanks for the link.
    – Steve P
    Commented Oct 20, 2010 at 18:36
  • No worries :) Could mark as Answer so others may find an answer to similar question they have.
    – James Love
    Commented Oct 20, 2010 at 19:21
2

We found that by using PowerShell code like this

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges( {
    $site = get-spsite "http://localhost/nonfarmadminsitecollection"
})
$elevatedSite = new-object Microsoft.SharePoint.SPSite([Guid]$site.ID,$site.SystemAccount.UserToken)

We are then able to upgrade the features in $elevatedSite.

1
  • Note that RunWithElevated has no function within powershell. It's purpose is to revert the impersonated user back to the process identity. In a web application, this is the application pool identity. In Powershell, there is no impersonation.
    – James Love
    Commented May 15, 2015 at 12:53

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.