GeneralDiskCleanUpModule.psm1


<#PSScriptInfo
 
.VERSION 1.7
 
.GUID eebef4cc-e1aa-4d6a-bc91-152d6ed67631
 
.AUTHOR WBachelder
 
.COMPANYNAME
 
.COPYRIGHT
 
.TAGS
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
 
 
#>


<#
 
.DESCRIPTION
 This is a general disk clean up module
 
#>
 

Param()

function GeneralDiskCleanUp {
    Get-ChildItem "C:\Windows\SoftwareDistribution\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows\prefetch\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Temp\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows\system32\wbem\Logs\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows\system32\Logfiles\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows\Debug\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows\Downloaded Program Files\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows\LiveKernelReports\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Roaming\Microsoft\Internet Explorer\UserData\Low\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\WER\ERC\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\INetCache\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Users\*\AppData\Local\Google\Chrome\User Data\Default\Cache\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows.old\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem "C:\Windows10Upgrade\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue;
    Get-ChildItem 'C:\$Recycle.Bin\*' -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    get-psdrive -psprovider filesystem;
}

function PackageCleanUp {
    Get-ChildItem "C:\Users\*\AppData\Local\Packages\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    get-psdrive -psprovider filesystem;
}
function TEAMSCleanUp {
    Get-ChildItem "C:\Users\*\AppData\Roaming\Microsoft\Teams\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue;
    get-psdrive -psprovider filesystem;
}