Skip to content

Instantly share code, notes, and snippets.

@iqwirty
Created April 17, 2014 19:26
Show Gist options
  • Save iqwirty/11006341 to your computer and use it in GitHub Desktop.
Save iqwirty/11006341 to your computer and use it in GitHub Desktop.
First iteration of a script to help find / rid various stuff left on a Windows computer
Clear-Host
$outputFile = "c:\tempo\cleaner-$(Get-Date -Format yyyy-MM-dd_hh-mm-ss).log"
$pathsToClean = @("$Env:USERPROFILE\AppData\Roaming\Microsoft\Word", `
"$Env:USERPROFILE\AppData\Roaming\Microsoft\Excel", `
"$Env:USERPROFILE\AppData\Roaming\Microsoft\PowerPoint", `
"$Env:USERPROFILE\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word", `
"$Env:USERPROFILE\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO", `
"$Env:USERPROFILE\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook", `
"$Env:USERPROFILE\AppData\Local\Microsoft\Office\UnsavedFiles", `
"$Env:TEMP", `
"c:\temp", `
"$Env:USERPROFILE\AppData\Local\Temp", `
"c:\windows\temp", `
"$Env:USERPROFILE\Downloads"
)
ForEach ($p in $pathsToClean) `
{
"$p : $((dir -Path "$p" -Recurse | Measure-Object).Count)" | Out-File -FilePath $outputFile -Append
dir -Path $p -Recurse | Select FullName | Out-File -FilePath $outputFile -Append
}
Invoke-Item $outputFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment