We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


powershell command to get directory size of remote pc of files over x mb

samiam41 asked
Medium Priority
Last Modified: 2012-06-27
Hi Experts.  I am getting more familar with powershell and the more I use/test with it, the more I like it.  Since there is a computer in our environment that is showing it has less than 25% disk space left (thanks SpiceWorks for the warning), I would like to use powershell to run a quick audit to tell me what file(s) may be blowing up.  

I ran dir \\pc\c$ -r and the list of files and their sizes just kept going and going.  Would one of you that know what switch I am missing kindly tell me how to filter out file sizes that are less than 10mb or are over 10mb (which ever is easier), please?  

Your help is greatly appreciated.  Thanks!
Watch Question

This is a way to list the largest X number of files, so not exactly what you are asking for, but maybe it will work for what you are trying to do.

It will take a while as it reads every file, but when it is done it will only show you the largest 20 files.  You can change the 20 to whatever you want.
dir \\pc\c$ -r|sort-object -descending|select -first 20

Open in new window

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


Smart man!  There is so much to learn.  Thanks for finding it.  Testing it now.



It would be great to work with you again.  BTW, where is the best place/site to learn Powershell?  I'm hitting up the technet site but wanted to ask if you knew of other good sites.

Thanks again
There are so many....
Best thing to do is Google Powershell and whatever you are trying to do.

Thanks for the grade, and I look forward to working with you again!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.