- 2021 NITRO Z20 Pro. In addition to celebrated NITRO® performance, the Z20 Pro includes popular upgrade options at an incredible value—you save $5,290 off the normal upgrade price! The brain of this fish-catching powerhouse is two Humminbird® HELIX™ fishfinders networked together and to a Minn Kota® Ultrex® trolling motor, giving you the control to find fish and stay.
- PLEASE BE ADVISED! ALL Municipal Court Fines and Traffic Tickets MUST be paid at Municipal Court, located at 497 1st AVE South, Nitro WV 25143, which is directly adjacent to the Nitro Police Department.
- Our free software lets you customize the NVIDIA GeForce Driver package by removing components that you don't need (or want). This not only keeps things tidy, but also lowers disk usage and memory footprint.
This is a script I have written to easily run on clients and servers which cleans up all common locations and logs etc
This is a script which I have been building over the last few months and I have tested and used on Windows 7,8,10, 2008r2 machines without issue.
Cleans up the following
Windows Event Logs
Restore Points
Windows and User Temp and Internet Temp Files
Windows and User Temp and Internet WER Files
Memory Dump & Mini dump Files
Windows Update Download Files
A few left over folders and files from updates and installs
Installs and Runs Windows Cleanup with all options selected (Silently)
Pentius PAB10228 UltraFLOW Air Filter for Dodge Nitro (07-09), Jeep Liberty (08-09) 5.0 out of 5 stars 3. Get it as soon as Mon, Apr 12. Cleaner, Brighter Cold Brew, Without the Cleanup - (2 Quart Pitcher Size) 4.7 out of 5 stars 363. Get it as soon as Wed, Apr 7. FREE Shipping on orders over $25 shipped.
Still need to add IIS Logs
This script will just run without any prompts so please make sure you test and are are happy with it before running on live systems. You can always just comment out what you don't want, such as event logs.
Save the attached as 'Windows_Cleanup.PS1' (Power shell Script) and the below as a batch file and save them into the same directory and then run the Batch file
powershell.exe -ExecutionPolicy Bypass -File '%~dp0Windows_Cleanup.ps1'
pause
Nitro Cleanup Utility Download
3 Steps total
Step 1: Create Batch File
Create a Folder and save the following as a batch file
powershell.exe -ExecutionPolicy Bypass -File '%~dp0Windows_Cleanup.ps1'
pause
Step 2: Create the Powershell script
In the same folder as Step1, created a powershell file (Test File) and call it Windows_Cleanup.ps1
Then add these lines to it
# Written by Fabian Castagna
# Used as a complete windows cleanup tool
# 15-7-2016
function Delete-ComputerRestorePoints{
[CmdletBinding(SupportsShouldProcess=$True)]param(
[Parameter(
Position=0,
Mandatory=$true,
ValueFromPipeline=$true
)]
$restorePoints
)
begin{
$fullName='SystemRestore.DeleteRestorePoint'
#check if the type is already loaded
$isLoaded=([AppDomain]::CurrentDomain.GetAssemblies() | foreach {$_.GetTypes()} | where {$_.FullName -eq $fullName}) -ne $null
if (!$isLoaded){
$SRClient= Add-Type -memberDefinition @'
[DllImport ('Srclient.dll')]
public static extern int SRRemoveRestorePoint (int index);
'@ -Name DeleteRestorePoint -NameSpace SystemRestore -PassThru
}
}
process{
foreach ($restorePoint in $restorePoints){
if($PSCmdlet.ShouldProcess('$($restorePoint.Description)','Deleting Restorepoint')) {
[SystemRestore.DeleteRestorePoint]::SRRemoveRestorePoint($restorePoint.SequenceNumber)
}
}
}
}
Write-Host 'Deleting System Restore Points'
Get-ComputerRestorePoint | Delete-ComputerRestorePoints # -WhatIf
Write-host 'Checking to make sure you have Local Admin rights' -foreground yellow
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator'))
{
Write-Warning 'Please run this script as an Administrator!'
If (!($psISE)){'Press any key to continue…';[void][System.Console]::ReadKey($true)}
Exit 1
}
Write-Host 'Capture current free disk space on Drive C' -foreground yellow
$FreespaceBefore = (Get-WmiObject win32_logicaldisk -filter 'DeviceID='C:' | select Freespace).FreeSpace/1GB
Write-host 'Deleting Rouge folders' -foreground yellow
if (test-path C:Config.Msi) {remove-item -Path C:Config.Msi -force -recurse}
if (test-path c:Intel) {remove-item -Path c:Intel -force -recurse}
if (test-path c:PerfLogs) {remove-item -Path c:PerfLogs -force -recurse}
# if (test-path c:swsetup) {remove-item -Path c:swsetup -force -recurse} # HP Software and Driver Repositry
if (test-path $env:windirmemory.dmp) {remove-item $env:windirmemory.dmp -force}
Write-host 'Deleting Windows Error Reporting files' -foreground yellow
if (test-path C:ProgramDataMicrosoftWindowsWER) {Get-ChildItem -Path C:ProgramDataMicrosoftWindowsWER -Recurse | Remove-Item -force -recurse}
Write-host 'Removing System and User Temp Files' -foreground yellow
Remove-Item -Path '$env:windirTemp*' -Force -Recurse
Remove-Item -Path '$env:windirminidump*' -Force -Recurse
Remove-Item -Path '$env:windirPrefetch*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalTemp*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftWindowsWER*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftWindowsTemporary Internet Files*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftWindowsIECompatCache*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftWindowsIECompatUaCache*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftWindowsIEDownloadHistory*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftWindowsINetCache*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftWindowsINetCookies*' -Force -Recurse
Remove-Item -Path 'C:Users*AppDataLocalMicrosoftTerminal Server ClientCache*' -Force -Recurse
Write-host 'Removing Windows Updates Downloads' -foreground yellow
Stop-Service wuauserv -Force -Verbose
Stop-Service TrustedInstaller -Force -Verbose
Remove-Item -Path '$env:windirSoftwareDistribution*' -Force -Recurse
Remove-Item $env:windirLogsCBS* -force -recurse
Start-Service wuauserv -Verbose
Start-Service TrustedInstaller -Verbose
Write-host 'Checkif Windows Cleanup exists' -foreground yellow
#Mainly for 2008 servers
if (!(Test-Path c:windowsSystem32cleanmgr.exe)) {
Write-host 'Windows Cleanup NOT installed now installing' -foreground yellow
copy-item $env:windirwinsxsamd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7dacleanmgr.exe $env:windirSystem32
copy-item $env:windirwinsxsamd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63cleanmgr.exe.mui $env:windirSystem32en-US
}
Write-host 'Running Windows System Cleanup' -foreground yellow
#Set StateFlags setting for each item in Windows disk cleanup utility
$StateFlags = 'StateFlags0013'
$StateRun = $StateFlags.Substring($StateFlags.get_Length()-2)
$StateRun = '/sagerun:' + $StateRun
if (-not (get-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesActive Setup Temp Folders' -name $StateFlags)) {
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesActive Setup Temp Folders' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesBranchCache' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesDownloaded Program Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesInternet Cache Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesOffline Pages Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesOld ChkDsk Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesPrevious Installations' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesMemory Dump Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesRecycle Bin' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesService Pack Cleanup' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesSetup Log Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesSystem error memory dump files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesSystem error minidump files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesTemporary Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesTemporary Setup Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesThumbnail Cache' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesUpdate Cleanup' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesUpgrade Discarded Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesUser file versions' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows Defender' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows Error Reporting Archive Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows Error Reporting Queue Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows Error Reporting System Archive Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows Error Reporting System Queue Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows Error Reporting Temp Files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows ESD installation files' -name $StateFlags -type DWORD -Value 2
set-itemproperty -path 'HKLM:SoftwareMicrosoftWindowsCurrentVersionExplorerVolumeCachesWindows Upgrade Log Files' -name $StateFlags -type DWORD -Value 2
}
Write-host 'Starting CleanMgr.exe..' -foreground yellow
Start-Process -FilePath CleanMgr.exe -ArgumentList $StateRun -WindowStyle Hidden -Wait
Write-host 'Clearing All Event Logs' -foreground yellow
wevtutil el | Foreach-Object {Write-Host 'Clearing $_'; wevtutil cl '$_'}
Write-host 'Disk Usage before and after cleanup' -foreground yellow
$FreespaceAfter = (Get-WmiObject win32_logicaldisk -filter 'DeviceID='C:' | select Freespace).FreeSpace/1GB
'Free Space Before: {0}' -f $FreespaceBefore
'Free Space After: {0}' -f $FreespaceAfter
Step 3: Run the cleanup script (Batch File)
Once complete run the batch file, this will automatically run through the cleanup script and at the end report the dish usage before and after the script has run.
17 Comments
- Thai PepperDavid Auth Feb 16, 2017 at 12:06am
Shouldn't this have been contributed as a script instead of a how-to?
I'll test it out, all the same. Thanks!
- DatilMichael.SC Feb 16, 2017 at 12:12am
Rather than using absolute paths you should use more environmental variables instead.
- SerranoFabian2990 Feb 16, 2017 at 12:20am
Feel free to make updates and suggestions.
Whilst i can write and understand (Decipher) most scripting I'm still a bit of a hack and still learning as i go.. - Maceadrian_ych Feb 16, 2017 at 12:29pm
This is a cool script but I do get errors at the start with the removal of windows updates clean up...
After the script ends, I ran the drive cleanup tool and I still have about 12GB of Windows update files which I cleaned using the tool.Overall....very nice tool....
- Poblanojasonyang Feb 16, 2017 at 04:44pm
Excellent work. This is very impressive and easy to use.
- SerranoReak Havik Feb 16, 2017 at 04:46pm
Sounds fun, i will have to try this on an old windows 7.
- TabascoITPro1000 Feb 16, 2017 at 04:48pm
Tron: An app built by custom scrips, and is constantly updated, that does everything from windows repair to virus removal, defragment, bloatware removal, etc...
You can get it here: https://www.reddit.com/r/TronScript/wiki/downloads - SerranoFabian2990 Feb 16, 2017 at 08:49pm
Just to add to this! you can also invoke the command on remote machines to make life even easier!
powershell.exe -ExecutionPolicy Bypass invoke-command -computer PCNAME? -filepath 'servernameshareWindows_Cleanup.ps1' | Out-File 'servernameshareWindows_Cleanup-%pcname%.log' -Append
- AnaheimRichard2663 Feb 17, 2017 at 01:56pm
that would be useful Fabian !!
would i create a batch file with that command in it ?
obviously changing the file paths and PC name?
- JalapenoCaptHelpful Feb 17, 2017 at 02:04pm
Just curious - how is this different than CCleaner? I've used it for years and been happy w/ the free version.
- Datilchrisf7 Feb 17, 2017 at 02:35pm
FYI if you download tron it has a built in defragger, which you won't want to run on any devices with SSD's.
- SerranoFabian2990 Feb 20, 2017 at 03:42am
Whilst Tron and CCleaner are good tools to use.
I wanted something that I can change and tweak as i went along and because our clients are spread out across a WAN network, i wanted something with a small foot print so it wouldn't effect WAN performance (Transferring files etc). We use a Client Management App that I have written in house, in which i can simply right click a client and run cleanup (Once finished I get a text file report back) - SerranoFabian2990 Feb 20, 2017 at 03:50am
As mentioned above you can run this remotely on other machines, you will need to have your management of clients setup correctly to allow it though.
(WIN-RM, Firewall, Admin rights etc)Simply save this as a batch file, update the PS1 path and set the PC name.
You could pass a variable to the script to input the computer name.
filename.cmd PCNAMErem
set PC=%1
set SRVPath=servernamesharepowershell.exe -ExecutionPolicy Bypass invoke-command -computer %PC% -filepath '%SRVPath%Windows_Cleanup.ps1' | Out-File '%SRVPath%Windows_Cleanup-%PC%.log' -Append
rem
- SonoraNanD0 Jun 18, 2017 at 07:53am
how did you learn to make a script like this and specific tutorial that you would recommend?
- SerranoFabian2990 Jun 18, 2017 at 09:54pm
I tend to be able to read scripts/programming and pull them apart and learn from them.
Other then that google and a lot of playing and testing
- 1
- 2
Note: Use these steps for Windows programs. If you're having problems with an app you got from Microsoft Store, go to Fix problems with apps from Microsoft Store.
The Program Install and Uninstall troubleshooter helps you automatically repair issues when you're blocked from installing or removing programs. It also fixes corrupted registry keys.
First, you'll need to download the troubleshooter.
If you see the File Download box when you start downloading, select Run or Open.
The troubleshooter provides steps for you to follow. If a program isn't listed in the uninstall options, you'll be asked for that program's product code. To access the code, you'll need a tool for reading MSI files—which is typically available to IT professionals. You'll find the product code in the property table of the MSI file.
What it fixes
The troubleshooter helps fix problems that:
Corrupt registry keys on 64-bit operating systems.
Corrupt registry keys that control the update data.
Prevent new programs from being installed.
Prevent existing programs from being completely uninstalled or updated.
Block you from uninstalling a program through Add or Remove Programs (or Programs and Features) in Control Panel.
If you're trying to remove malware, you can use Windows Security (or another antivirus tool), or you can use the Windows Malicious Software Removal tool.
Runs on
Windows 10
Windows 8.1
Windows 8
Windows 7