Skip to content

Instantly share code, notes, and snippets.

@bohack
Created October 31, 2018 14:34
Show Gist options
  • Save bohack/388bd03260c3b73f82d05f499a0e1be7 to your computer and use it in GitHub Desktop.
Save bohack/388bd03260c3b73f82d05f499a0e1be7 to your computer and use it in GitHub Desktop.
PowerShell to Read the Folders Information (Profile Cleanup)
Get-ChildItem y:\ | ForEach-Object {
Get-ChildItem y:\$_ | ForEach-Object {
$Size = "{0:N2} MB" -f ((Get-ChildItem $_.fullname -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB)
$Out = $_.FullName + "," + $_.LastWriteTime + "," + $Size + "," + $_
Write-Host $Out
Out-File -Append -InputObject $Out -FilePath .\output.csv -Encoding ascii
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment