Disk Cleanup
Has anyone found a good way to do a cleanup of the HDD using PDQ Deploy?
Can't seem to find a good way to automate it.
Thanks,
Tim Bryant
0
Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.
Has anyone found a good way to do a cleanup of the HDD using PDQ Deploy?
Can't seem to find a good way to automate it.
Thanks,
Tim Bryant
Comments
To cleanups your disk space there are some software available and my favorite among them is disk space analyzer.
Hi,
I need help to figure out how to run this script via PDQ Deploy. In my case it won't run and stuck in the process if I run it as a "Deploy user" but if I run it as a "Logged on User" it works. But, I would like to push this script for all computers over the night and users will not be logged in during that time, I hope it makes sense
# Create reg keys
$volumeCaches = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
foreach($key in $volumeCaches)
{
New-ItemProperty -Path "$($key.PSPath)" -Name StateFlags0099 -Value 2 -Type DWORD -Force | Out-Null
}
# Run Disk Cleanup
Start-Process -Wait "$env:SystemRoot\System32\cleanmgr.exe" -ArgumentList "/sagerun:99"
# Delete the keys
$volumeCaches = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
foreach($key in $volumeCaches)
{
Remove-ItemProperty -Path "$($key.PSPath)" -Name StateFlags0099 -Force | Out-Null
}
Here's a resource you could tailor to your needs: https://gallery.technet.microsoft.com/scriptcenter/Disk-Cleanup-Using-98ad13bc
Ping me if you need some help with the powershell scripting, I write it as my day job and would be happy to help cobble something together.
Did either of you successfully deploy a Disk Cleanup? If so I would love to see it.
Ccleaner portable with the /auto option works amazing.