Using PowerShell to get the size of folders (Get-FolderSize function)

On my gaming PC Windows complained that C:\ had only 10GB of free space left. Time to free up some space! In WindowsXP times I used a separate Program called GetFolderSize for this, but nowadays with PowerShell I was like: "Hey, I bet I can do this with PowerShell alone." After a bit of back & forth I came up with the following function: function Get-FolderSize { param([string]$Path = ".")…