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

Comments

5 comments
Date Votes
  • Could you wrap cleanmgr in a powershell script?

    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.
    0
  • Did either of you successfully deploy a Disk Cleanup? If so I would love to see it.

    0
  • To cleanups your disk space there are some software available and my favorite among them is disk space analyzer. 

    1
  • Ccleaner portable with the /auto option works amazing.

    0
  • 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
    }

    1

Please sign in to leave a comment.

Didn't find what you were looking for?

New post