Hello fellow spiceworkers,<\/p>\n
I need to run the disk cleaning tool from Windows 100% automatic on my servers.I know that there is the possibilty to add this as a task in Task scheduler but the problem is there are 60 servers on which I want to configure this. Therefore I need a solution to push this setting globally to all the servers. Is this perhaps possible via MSSC or a command line? And if so, how would I need to do it.<\/p>\n
The OS on all servers is either ws2012 or ws2012 r2<\/p>\n
Regards<\/p>","upvoteCount":2,"answerCount":7,"datePublished":"2016-09-23T06:25:19.000Z","author":{"@type":"Person","name":"ralphfessem","url":"https://community.spiceworks.com/u/ralphfessem"},"acceptedAnswer":{"@type":"Answer","text":"
Hello<\/p>\n
Use Group Policy and use Computer Configuration - Prefrences - Control Panel Settings - Scheduled Tasks and put what you want in there<\/p>","upvoteCount":1,"datePublished":"2016-09-23T06:30:52.000Z","url":"https://community.spiceworks.com/t/cleanmgr-exe-fully-automatic/527765/2","author":{"@type":"Person","name":"pdickason","url":"https://community.spiceworks.com/u/pdickason"}},"suggestedAnswer":[{"@type":"Answer","text":"
Hello fellow spiceworkers,<\/p>\n
I need to run the disk cleaning tool from Windows 100% automatic on my servers.I know that there is the possibilty to add this as a task in Task scheduler but the problem is there are 60 servers on which I want to configure this. Therefore I need a solution to push this setting globally to all the servers. Is this perhaps possible via MSSC or a command line? And if so, how would I need to do it.<\/p>\n
The OS on all servers is either ws2012 or ws2012 r2<\/p>\n
Regards<\/p>","upvoteCount":2,"datePublished":"2016-09-23T06:25:19.000Z","url":"https://community.spiceworks.com/t/cleanmgr-exe-fully-automatic/527765/1","author":{"@type":"Person","name":"ralphfessem","url":"https://community.spiceworks.com/u/ralphfessem"}},{"@type":"Answer","text":"
Alternatively you can script it in powershell and then push the script using group policy:<\/p>\n
Write-Verbose ‘Clearing CleanMgr.exe automation settings.’ Get-ItemProperty -Path ‘HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches*’ -Name StateFlags0001 -ErrorAction SilentlyContinue | Remove-ItemProperty -Name StateFlags0001 -ErrorAction SilentlyContinue Write-Verbose ‘Enabling Update Cleanup. This is done automatically in via a scheduled task in Windows 10.’ New-ItemProperty -Path ‘HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches\\Update Cleanup’ -Name StateFlags0001 -Value 2 -PropertyType DWord Write-Verbose ‘Enabling Temporary Files Cleanup.’ New-ItemProperty -Path ‘HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VolumeCaches\\Temporary Files’ -Name StateFlags0001 -Value 2 -PropertyType DWord Write-Verbose ‘Starting CleanMgr.exe…’ Start-Process -FilePath CleanMgr.exe -ArgumentList ‘/sagerun:1’ -WindowStyle Hidden -Wait Write-Verbose ‘Waiting for CleanMgr and DismHost processes. Second wait neccesary as CleanMgr.exe spins off separate processes.’ Get-Process -Name cleanmgr,dismhost -ErrorAction SilentlyContinue | Wait-Process $UpdateCleanupSuccessful = $false if (Test-Path $env:SystemRoot\\Logs\\CBS\\DeepClean.log) { $UpdateCleanupSuccessful = Select-String -Path $env:SystemRoot\\Logs\\CBS\\DeepClean.log -Pattern ‘Total size of superseded packages:’ -Quiet } if ($UpdateCleanupSuccessful) { Write-Verbose ‘Rebooting to complete CleanMgr.exe Update Cleanup…’ SHUTDOWN.EXE /r /f /t 0 /c ‘Rebooting to complete CleanMgr.exe Update Cleanup…’ }<\/p>","upvoteCount":0,"datePublished":"2016-09-23T09:34:26.000Z","url":"https://community.spiceworks.com/t/cleanmgr-exe-fully-automatic/527765/3","author":{"@type":"Person","name":"jamescope2","url":"https://community.spiceworks.com/u/jamescope2"}},{"@type":"Answer","text":"
see if this article helps as well:<\/p>\n