Today I had to get a count of items in a particular library. This library resides in all SPWebs in one of our site collections. In case anyone needs something like this I was able to achieve this by using the powershell script below.
$webapp = get-spwebapplication http://somewebapp.com;
foreach ($site in $webapp.sites)
{
       foreach ($web in $site.AllWebs)
       {
              $list = ($web.Lists | where-object {$_.title -eq “SomeName”})
             Â
              if($list.itemcount -gt 0)
              {  Â
$itemCount = $list.itemcount;
                      “SomeName Library located here: ” + $web.Url + ” has ” + $itemCount + ” items.” | Out-File -filepath C:\subtest1.txt -append
Â
             }
              $web.dispose();
       }
       $site.dispose();
}