Windows 10: Automating Clean Manager.

Discus and support Automating Clean Manager. in Windows 10 Performance & Maintenance to solve the problem; I thought I would post this more for information than anything else. It deals with the running of CleanMgr.exe in an Elevated CMD Prompt allowing the... Discussion in 'Windows 10 Performance & Maintenance' started by Paul Black, May 4, 2021.

  1. Automating Clean Manager.


    I thought I would post this more for information than anything else. It deals with the running of CleanMgr.exe in an Elevated CMD Prompt allowing the Hidden cleanup options to become available. I am about to Clean Install and then customise the OS. I decided to write a Batch Script that basically cleans up the OS after ALL the customisation so that it is in a tip top state ready for Imaging. One of the options is running CleanMgr in Advanced Mode, which basically gives you ALL the clean up options available, as opposed to the Basic Mode for example because I wanted ALL the boxes Checked. The problem with this, is that it asks for confirmation before continuing by pressing OK, which is NOT ideal as I wanted it fully automated. In another Batch Script, I use %ComSpec% /c cleanmgr.exe /sageset:65535 & cleanmgr.exe /sagerun:65535 which is fine, even though it involves me having to press OK, but for that particular scenario it is what I want. NOTE: You can use ANY number between 1 and 65535 for /sageset:, but you MUST use the SAME number for /sagerun: in order to use the Preset configuration created by /sageset:. Therefore, in order for this process to be automated, you first need to run cleanmgr.exe /sageset:65535 prior to including it in a Batch script. This creates a stored REG entry [ EVERY checkbox has its OWN SubKey ] for the Presets of ALL the selected checkboxes. REG file => HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches Here is mine after running cleanmgr.exe /sageset:65535, but obviously yours could be different . . . Now, all you need to use in the Batch Script is cleanmgr.exe /sagerun:65535, and because ALL the checkboxes are already Preset, there is NO prompt during processing. Basically, once the Presets are configured in the Registry, you just need to run the cleanmgr.exe /sagerun:65535 command. Summary: Once cleanmgr.exe /sageset:65535 has been run and Preset, you can just use cleanmgr.exe /sagerun:65535 in an Elevated CMD Prompt, in a Batch Script, or in a Shortcut, obviously using the SAME number that you used for /sageset:. WARNING: THIS WILL ALSO AUTOMATICALLY CLEANUP ANY PARTITIONS ON INTERNAL & EXTERNAL DRIVES. Additional Information: > CleanMgr - docs.microsoft.com > CleanMgr - ss64.com I just thought that someone might find this useful if they wanted to automate this process.

    :)
     
    Paul Black, May 4, 2021
    #1

  2. Automating Clean Manager.

    I thought I would post this more for information than anything else. It deals with the running of CleanMgr.exe in an Elevated CMD Prompt allowing the Hidden cleanup options to become available.

    I am about to Clean Install and then customise the OS. I decided to write a Batch Script that basically cleans up the OS after ALL the customisation so that it is in a tip top state ready for Imaging.

    One of the options is running CleanMgr in Advanced Mode, which basically gives you ALL the clean up options available, as opposed to the Basic Mode for example because I wanted ALL the boxes Checked. The problem with this, is that it asks for confirmation before continuing by pressing OK, which is NOT ideal as I wanted it fully automated.

    In another Batch Script, I use %ComSpec% /c cleanmgr.exe /sageset:65535 & cleanmgr.exe /sagerun:65535 which is fine, even though it involves me having to press OK, but for that particular scenario it is what I want.

    NOTE:

    • You can use ANY number between 1 and 65535 for /sageset:, but you MUST use the SAME number for /sagerun: in order to use the Preset configuration created by /sageset:.
    Therefore, in order for this process to be automated, you first need to run cleanmgr.exe /sageset:65535 prior to including it in a Batch script. This creates a stored REG entry [ EVERY checkbox has its OWN SubKey ] for the Presets of ALL the selected checkboxes.

    REG file => HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches

    Here is mine after running cleanmgr.exe /sageset:65535, but obviously yours could be different . . .


    Automating Clean Manager. [​IMG]


    Now, all you need to use in the Batch Script is cleanmgr.exe /sagerun:65535, and because ALL the checkboxes are already Preset, there is NO prompt during processing.

    Basically, once the Presets are configured in the Registry, you just need to run the cleanmgr.exe /sagerun:65535 command.


    Summary:

    Once cleanmgr.exe /sageset:65535 has been run and Preset, you can just use cleanmgr.exe /sagerun:65535 in an Elevated CMD Prompt, in a Batch Script, or in a Shortcut, obviously using the SAME number that you used for /sageset:.


    WARNING:

    THIS WILL ALSO AUTOMATICALLY CLEANUP ANY PARTITIONS ON INTERNAL & EXTERNAL DRIVES.


    Additional Information:

    > CleanMgr - docs.microsoft.com
    > CleanMgr - ss64.com


    I just thought that someone might find this useful if they wanted to automate this process.

    *Thumbs
     
    Paul Black, May 5, 2021
    #2
  3. Windows 10 infinite restart black screen


    The tutorials provided are just a list of troubleshooting steps. Use only the steps which apply to you.

    Since none of the troubleshooting steps here worked, I'd suggest you do a Clean install.

    John
     
    AmericanPharaoh, May 5, 2021
    #3
  4. Toothless Win User

    Automating Clean Manager.

    Silent boot failure

    List your specs out and tell us each step in cleaning you did.
     
    Toothless, May 5, 2021
    #4
Thema:

Automating Clean Manager.

Loading...
  1. Automating Clean Manager. - Similar Threads - Automating Clean Manager

  2. Task Automation

    in Windows 10 Customization
    Task Automation: HiI need to automate a number of tasks:1. I have a program that I use for stocks. It allows me to save data as a CSV. I need to automate the running of this program so it copies the data to a local folder.2. I have a data provider that provides data via SFTP. I need to...
  3. Task Automation

    in Windows 10 Software and Apps
    Task Automation: HiI need to automate a number of tasks:1. I have a program that I use for stocks. It allows me to save data as a CSV. I need to automate the running of this program so it copies the data to a local folder.2. I have a data provider that provides data via SFTP. I need to...
  4. Automate diskpart for Clean Install.

    in Windows 10 Installation and Upgrade
    Automate diskpart for Clean Install.: I want to FULLY Automate a Clean Install on Disk 0 [ the ONLY internal HDD ] with . . . [1] OS on C:\ >>> size=30720 - 30GB [2] Data on D:\ >>> size=51200 - 50GB [3] System_Image on S:\ >>> size=30720 - 30GB I want to use a Script to achive this which I will run after...
  5. Device Manager Driver Update Automation Script?

    in Windows 10 Drivers and Hardware
    Device Manager Driver Update Automation Script?: Is this a thing? Updating drivers once in awhile isn't bad, but manually right-clicking, properties, search online for each driver gets very tedious. There has to be someone who has this type of script, right? If so, where can I find it? Thanks!...
  6. File Management Automation

    in Windows 10 Ask Insider
    File Management Automation: Does anyone know about an automation software akin to Hazel for mac? I recently switched to Windows from Mac for work and want to automate some of my file-management. submitted by /u/red_beard_the_irate [link] [comments]...
  7. Advanced automation

    in Windows 10 Support
    Advanced automation: Hopefully someone can help me with a task I have. I have about 70 URLs and on each page is a Vimeo video. For me to get a downloadable link to the Vimeo video I have to go into developer tools and get the direct download link to the Vimeo video so I can save it to my...
  8. Automated Restarts..?

    in Windows 10 Installation and Upgrade
    Automated Restarts..?: What Microsoft employee is responsible for Windows update policies? Please provide a direct telephone number to the correct Microsoft executive so I can tell them to F#@K OFF for withholding my control over restarting my personal computer. There must be a single...
  9. Clean task manager?

    in Windows 10 Customization
    Clean task manager?: Is there anyway for me to drop the amount of processes i am using in task manager i feel like 162 processes is quite a bit and i don't know what to get rid of without ruining my pc. https://imgur.com/a/YpI5Hcz...
  10. Automate LOGIN

    in User Accounts and Family Safety
    Automate LOGIN: Is there a way to automate a LOGIN? I often need to login to a large number of pcs. I was wandering if there is a way to do it automatically by connecting an usb. Thanks 99320