0

How to count number of pages in Site and Sub Sites using powershell ??

Thanks

2
  • 1
    What kind of pages? Site page or other page?
    – Aanchal
    Commented Sep 12, 2014 at 10:29
  • pages in pages library Commented Sep 12, 2014 at 10:30

2 Answers 2

1

You can use the script below :

 $URL="http://site.Site.com"
 $BASETEMPLATE="Pages"


    $site = Get-SPSite $URL     
    $totalItems = 0     
    foreach($web in $site.AllWebs)     
    {         
        $lists = $web.Lists         
        for ($i=0; $i -le $lists.Count – 1; $i++)          
        {             
            $list = $lists[$i]             
            if ($list.Title -eq "Pages")             
            {                 
                $totalItems = $totalItems + $list.Items.Count             
            }         
        }             
    }     
    $site.Dispose()     
    write-host $totalItems 
0
$sitecollURL = " "
$totalsubsites = 0

$site = Get-SPSite $sitecollURL

foreach($subsites in $site.AllWebs)
{
  $totalsubsites++;
}
write-host $totalsubsites

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.