0

I use Get-SPSite powershell command to get the site collections in our sharepoint environment. It has only -Limit 'some value' or -Limit All parameters.

If I have 1000 site collections, can I get 100 by 100 by using -Filter parameter or anything ?

Thanks.

  • Any specific type of site collections that you would like to retrive? Or just 100 random out of 1000? – Christoffer Jan 11 '17 at 16:06
  • I want to get all 1000 as 100 by 100. – Shen Prabu Jan 11 '17 at 18:09
  • Any specific reason why you need to do this? I'm thinking it would be easier to export the output of get-spsite -limit all to an Excel file and then group objects by 100 there. – Christoffer Jan 12 '17 at 8:03
  • No, 1000 here is an example. our client has 42300 site collections that it takes more that 45 minutes to get all the result using -Limit All. – Shen Prabu Jan 16 '17 at 12:52
0

With the following script you can view all Sites in steps of 100:

Add-PSSnapin Microsoft.SharePoint.PowerShell;

$allSites = Get-SPSite -limit All;

for($i = 1; $i -lt $allSites.Count;$i++)
{
    write-host $allsites[$i-1];

    if($i % 100 -eq 0)
    {
        write-host ($i) "/"  $allSites.Count;
        read-host;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.