Sunday, July 29, 2018

QuickPost: PowerShell Scripts and Win 10 Helps

Since having a system migrated to Windows 10, I’ve noticed a trend of the hard-drive getting significantly fuller now.  I’ve done all the standard post-migration cleanups. I cleared over 40 GB of old software packages off the system and was feeling pretty good.  The next day all my space-gains were lost and I was back at 100 GB of free space where I started.

I suspect there is some caching activity going on in the background and that it running off a quota that keeps me returning to the magical 100 GB free of a 500 GB drive.

Normally, I’d just run one of these tools to identify the space/file hogs and start cleaning up. I’ve ordered these in my general preference; though I like them all for slightly different things they bring to the table on a space-hunt.

However in this case I cannot use any third-party tools and must stick with using Microsoft OS-based solutions only.

So that led me to find a script I could use in PowerShell.

I’ve divided them into file-size analyzers and folder-size analyzers.

I found it is relatively easy to hunt down singular files on your system in PowerShell that are the largest. However, what happens if you have a bunch-load of very small files? Individually they may never float to the top, however in aggregate, they could add up to a lot of space usage.

I’ve listed these as well in my order of preference.

Note: They all seemed to run fine on my Win 10 systems in PowerShell ISE – though tweaking was needed for each one to target specific folders and/or report outputs – depending on the script.

PowerShell File-Hog Hunters

PowerShell Folder-Hog Hunters

If you do export output to CSV and don’t “pre-format” the bytes output to MB, here is a tip on a custom formatting rule in Excel you can use to make it more readable.

formatting - How can I format bytes a cell in Excel as KB, MB, GB etc? - Stack Overflow

I’ve not loaded Ubuntu on Windows to have a Bash console, but in looking for tools, I came across this that looked pretty neat: ncdu: Identify Large Files on Windows 10 - Trevor Sullivan

Finally, on Win 7 I used a pretty small set of common keyboard shortcut to navigate my way around the system.  In Windows 10, I’m finding a desire to expand my quick-access key combo skills. Here are some good resources:

If I’ve missed a useful script or you have any tips for hunting for space/file hogs using only “on-board” native Windows 10 OS tools, please drop a comment!

I expect I’ll be adding to the list of links in this post too as I uncover more PowerShell scripts that could be useful. As I post this, I think I am overlooking one or two others that I found useful

Cheers!

--Claus V.