Powershell Script to Efficiently Locate Large Files in SharePoint 2010/2013

23 Mar 2015
March 23, 2015

Recently I had the request to locate all files that are bigger than 40 MB – and they were located in the entire farm across multiple Site Collections.  Easy you might say? Just use search and query for

size>41943040

Well, I said efficiently and thats the most efficient way – you are right! They key constraint here is that those files were excluded from search – so lets go for the PowerShell way.

The Script

Here comes the script that uses PowerShell to iterate over each Site Collection, every Web and every List – then uses CAML to query each list for items larger than the specified size. It works for SharePoint 2013 and should definitely work for 2010, too.

Enough words, here we go:

Result

The result looks like this:

Get large files script in action

Get large files script in actionYou can easily export that to a csv file

You can easily export that to a csv file with:

$result | export-csv result.csv

I ran it again a quite large SharePoint 2013 environment (~1 TB, 1075 Site Collections) and it came back in ~5 minutes.

Feedback!

You see room for improvement for my PowerShell script to efficiently locate large files? If so, please tell me!

Max Melcher
Follow me!

Max Melcher

Maximilian Melcher (MCSE, MCPD) is a Principal Consultant working at Alegri International Services in Munich, Germany. Max is a specialist in SharePoint technologies focused on search, social computing, web content management and collaboration. Max has led SharePoint implementations for Dax 30 companies since 2009.
Max’s free time is spent on twitter (@maxmelcher) mostly with a good coffee in his hands.
Max Melcher
Follow me!
Tags: ,
1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close