Microsoft Teams and Skype for Business News and Thoughts

Tom Arbuthnot MVP
Tom Arbuthnot MCSM Communications

This site uses cookies

Find this blog useful? Please take a second to share, thanks!

Get-DirectorySize : Quickly finding what was eating all my hard drive space with PowerShell

Published 16/10/2014 - 3 Comments

One of my machines was inexplicably running out of hard drive space on it’s OS drive. I cleared it down a couple of times, and within a day or two it was full again



I turned to the tool that solves all problems, PowerShell. I wrote a quick and dirty script to take a starting directory, and recurses all directories, measuring the size for each one, You can find the script on my Github here:

It does error on some protected paths, even when run from PowerShell as an administrator, I think you could get around that by running it as a service account, but I didn’t need to in this case.

I checked the whole drive, which took some time, and found the following:


Hmm, that’s a little on the large side:


It seems I hit this bug, which causes the windows.edb which is the windows search cache, to bloat out.

A quick rebuild and so far it seems fine.



I’m sure I could have found a tool to map out the directory size/could have searched for single large files, but it’s nice to have a tool as flexible as PowerShell to quickly nock up a script to help you troubleshoot issues

Tom Arbuthnot

Tom Arbuthnot

Principal Solutions Architect at Modality Systems
Tom Arbuthnot is Principal Solutions Architect at Unified Communications specialist Modality Systems. He is a Microsoft Certified Master and MVP, blogger, regular on The UC Architects Podcast, and speaker at events including Microsoft TechEd and Ignite. He co-runs The Microsoft UC User Group London.


Tom - 17/10/2014 Reply

You should try SpaceSniffer. It’s not PowerShell, but it’s still cool! It maps your drive out into coloured blocks so you can really easily see where the space is going. Good for those of us with big VMs and small SSDs!

Windows.edb Windows Search Index Bloats and Eats Hard Drive Space | Tom Talks UC - 13/07/2015 Reply

[…] had this a couple of times now, so thought a quick post might be […]

Leave a Reply:


Weekly Email Update 
of all the key 
Microsoft Teams and Skype for Business News
every Tuesday

No Spam ever, I promise - Tom