PowerShell – Add or remove a site collection administrator from all sites

This is an issue I recently faced.  I needed to add myself as a site collection administrator to 100+ site collections.  I did not want to do this manually because it would have taken too much time.  So what did I do, I put it off until I got fed up with having to add myself manually each time I needed access.  I started searching for posts and found and excellent article on how to achieve this via PowerShell.

Here is the link to the original post: http://blog.henryong.com/2011/04/08/adding-or-removing-a-site-collection-administrator-from-all-site-collections/
This worked perfectly except for one minor detail….no progress indicator.  This is usually not that big of a deal since PowerShell takes care of business so quickly, but this time, I wanted to know where I was during each step of the process.  To do this, I added a loop counter to display the current percentage of operation.  Once the script has run, it will write back to your screen the exact number of site collections modified.

Thanks to Henry Ong over at The SharePoint Swiss Army Knife for the main script.

To remove someone from the site collection admins, simply change the variable $add = 1 to $add = 0.  What I did was create a separate script for removing and updated the verbage in the write progress to indicate that I was removing a user.

Stay Salty!

Cannot find the FAST site template

By default, the FAST search site template is missing.  It has to be enabled via PowerShell.  Luckily, this is a very simple process.

Perform the following steps to enable the template:

  1. Login to one of the web front ends
  2. Open the SharePoint Management Shell (PowerShell for SharePoint)
  3. Type or Copy/Paste in the following making sure to change the “Identity” to your site collection:

Your output should look like the below screenshot

fastfeature

Cannot publish InfoPath custom list form

Today, I ran across an issue when I went to customize a list with InfoPath.  I clicked on the ‘Customize Form’ button and it opened the item view in InfoPath as expected.  After I made my changes I went to publish my form.  I received the following error message:

“InfoPath cannot connect to the server.  The server may be offline, your computer might not be connected to the network, or InfoPath Forms Services 2010 might not be enabled on the server.  To fix this problem, start by checking your network connection, and then try again.”

Bummer!

After going through my normal rounds of troubleshooting (permissions, InfoPath, SharePoint logs, Event Viewer), I came across another blog that had the solution (at least, it worked for my issue)

Here is the link to the blog: http://brenthafnersblog.wordpress.com/2013/01/15/cannot-publish-infopath-forms-or-cutomized-list-forms-in-sharepoint-lists-2010/

Basically, all that needs to happen is that you need to reset InfoPath Form Services for that particular site collection.  To do that, just run the following PowerShell scripts from your SharePoint server:

Make sure to update the urls for the above commands

 

Enjoy and remember to Stay Salty!