locked
Adding mulitple site collection administrators to every site collection within a web application RRS feed

  • Question

  • I need to add a hand full of people that manage SharePoint to the site collection administrators group of every site collection in the farm. I don't want to go into all the hundreds of site collections and manually do this. Is there a way to script it in an STSADM command or do this at the web application level?

    Tuesday, July 12, 2011 2:27 PM

Answers

  • This one's a prime candidate for Powershell as well, if you have it installed on your server(s).  You can use PS to access a web application, and loop through all the site collections under it, setting up additional site collection admins.

    - M


    Michael Mukalian | Jan 2010 - Dec 2010 MVP SharePoint Services | MCTS: MOSS 2007 Configuration | http://www.mukalian.com/blog
    Tuesday, July 12, 2011 6:25 PM
  • Hi,

    This is a very easy task you can carry out by using sharepoint object model.

    You can write code into a console application and run it on your server.

    Your code can be like this

                SPSite site = new SPSite("Your Url");

                SPWebApplication webApp = site.WebApplication;

                SPSiteCollection sites = webApp.Sites;

                foreach (SPSite site1 in sites)

                {

                    //Add your code here

                }

    I hope this will help you out.

    Thanks,

    Rahul Rashu


    • Edited by Rashu,Rahul Wednesday, July 13, 2011 7:42 AM Adding code example
    • Marked as answer by Jeff M Bratton Monday, July 18, 2011 5:07 PM
    Tuesday, July 12, 2011 7:20 PM

All replies

  • Hi Jeff,

    Have your tried STSADM Adduser command? Here a Technet article on this.

    stsadm.exe -o adduser -url URL -userlogin DOMAIN\User_Name -useremail
    someone@example.com -role Site_Group_Name -username "Users Display Name"
    -siteadmin

    Hope this helps!


    BlueSky2010
    Tuesday, July 12, 2011 5:38 PM
  • This one's a prime candidate for Powershell as well, if you have it installed on your server(s).  You can use PS to access a web application, and loop through all the site collections under it, setting up additional site collection admins.

    - M


    Michael Mukalian | Jan 2010 - Dec 2010 MVP SharePoint Services | MCTS: MOSS 2007 Configuration | http://www.mukalian.com/blog
    Tuesday, July 12, 2011 6:25 PM
  • Hi,

    This is a very easy task you can carry out by using sharepoint object model.

    You can write code into a console application and run it on your server.

    Your code can be like this

                SPSite site = new SPSite("Your Url");

                SPWebApplication webApp = site.WebApplication;

                SPSiteCollection sites = webApp.Sites;

                foreach (SPSite site1 in sites)

                {

                    //Add your code here

                }

    I hope this will help you out.

    Thanks,

    Rahul Rashu


    • Edited by Rashu,Rahul Wednesday, July 13, 2011 7:42 AM Adding code example
    • Marked as answer by Jeff M Bratton Monday, July 18, 2011 5:07 PM
    Tuesday, July 12, 2011 7:20 PM