Last week I had a client reach out to me, asking for a count of all documents in their SharePoint 2010 internal farm. They were planning on implementing Metalogix StoragePoint and were working on estimates for the deployment.
After a bit of work with PowerShell, I was able to throw a single line of PowerShell that sum’s the entire environment for me.
Get-SPSite -Limit All | Get-SPWeb -Limit All | % { $_.Lists} | ? { $_ -is [Microsoft.SharePoint.SPDocumentLibrary] } | % { $total+= $_.ItemCount} ; $total
Love it? Share it!
Does this include custom lists or only document library files? I need to be sure that I am only getting library files and not form list items.
this was very helpful! Thanks!!
Hi , I was wondering if it will count all the documents in the document library and also within the folder inside the document library
Raj, this is the ItemCount that the SharePoint API is presenting, this should include all items inside of it including the items within the folders. I do not have a SharePoint farm available to test this in anymore though.