Monthly Archives: September 2014

Site Owners PowerShell Script – Kind Of

I was asked to come up with a script to generate the site owners for all the sites in a specific web application recently. I didn’t have much time to put anything together too fancy so I came up with this script. It looks at each SPWeb object and determents the users in the associated owner group for each SPWeb (SharePoint sub site).  This doesn’t take into account anyone who may have been granted full control explicitly and the $web.AssociatedOwnerGroup may or may not be correct..In this case it was. Hopefully this helps you out..or even provides a starting point to what you are trying to report on.


Additional Notes:

  • This script causes additional overhead on the SharePoint farm and should be ran in off hours. This sends a lot of requests to the database
  • Copy everything from function to the last “}” to load the function. Once the function is loaded you can run it using the last line of the script “GetSiteOwnersReport”
  • This does NOT take into account unique permissions. It only looks at the AssociatedOwnerGroup members for each SPWeb object

Cannot Activate Site Feature for SharePoint Publishing – Dang that pages library!

They other day I went to activate the Site (SPWeb) level publishing feature and I ran into an error. I tracked it down in the ULS Logs and found this entry:

08/13/2014 11:15:04.24 w3wp.exe (0x4D94) 0x4E50 SharePoint Foundation General 75fg High Exception was thrown while ensuring dependencies met for feature ‘PublishingWeb’ (id: 94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb): Microsoft.SharePoint.SPException: List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. —> System.Runtime.InteropServices.COMException (0x81020026): List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListsWithCallback(String bstrUrl

I did some digging and found 2 good links on the matter:

The following script worked for me. Note: I have ran into this issue multiple times and the main culprit is that the Pages library (Or another publishing library) is already created when you go to enable the SPWeb SharePoint Publishing Feature. You could use PowerShell or SharePoint Manager to delete those lists. Or even to update the pages library for the SPWeb object, but this script is much easier 🙂

Also, there was one instance where this script did not work and I needed to run the Enable-SPFeature cmdlet and use the -Force parameter. Once I did this I ran the script below and then everything started working.


 Update (10/29/14) – I have ran into this issue multiple times in the same environment now. Even though the above scripts fix the feature activation, the easiest fix has been to just deactivate and reactivate the SharePoint Publishing Infrastructure Site Collection Feature. This company is using a custom master page which needed some fixing up (Reactivating the site collection feature seemed to make the necessary changes).