Need to determine where your disk space went?
copy the following into a file named files.ps1
create a new folder named scripts and save this file in that folder (c:\scripts\files.ps1)
————————————————————————————-
# Loops through each directory recursively in the current directory and lists its size.
# Children nodes of parents are tabbedfunction getSizeOfFolders($Parent, $TabIndex) {
$Folders = (Get-ChildItem $Parent); # Get the nodes in the current directory
ForEach($Folder in $Folders) # For each of the nodes found above
{
# If the node is a directory
if ($folder.getType().name -eq “DirectoryInfo”)
{
# Gets the size of the folder
$FolderSize = Get-ChildItem “$Parent\$Folder” -Recurse | Measure-Object -property length -sum -ErrorAction SilentlyContinue;
# The amount of tabbing at the start of a string
$Tab = ” ” * $TabIndex;
# String to write to stdout
$Tab + ” ” + $Folder.Name + ” ” + (“{0:N2}” -f ($FolderSize.Sum / 1mb));
# Check that this node doesn’t have children (Call this function recursively)
getSizeOfFolders $Folder.FullName ($TabIndex + 1);
}
}
}# First call of the function (starts in the current directory)
getSizeOfFolders “.” 0
———————————————————————————
Now open an elevated powershell window (run as adminstrator)
and type the following:
c:\scripts\files.ps1 > c:\scripts\output.txt
it will run for a bit and the result will be similar to this output:
the numbers are in MB and the indented (tabbed) data represents sub folders (with the size next to the foldername)
hope someone finds this helpful