Created
December 19, 2023 14:22
-
-
Save msoler8785/c0abab944225bdf636fceb9a1eb8e879 to your computer and use it in GitHub Desktop.
Disk Cleanup Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all the Recycle Bins | |
Get-ChildItem -Path 'C:\$Recycle.Bin\' -Recurse -Hidden | Remove-Item -Force -Recurse -Verbose | |
# Delete all User Profiles on computer except active profiles. | |
# Warning! this will delete all documents and files under the user profile. | |
$profiles = Get-WMIObject -class Win32_UserProfile | Where-Object { $_.Special -eq $false -and $_.Status -eq 0 -and $_.Loaded -eq $false } | |
$profiles | Remove-WmiObject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment