Start-WindowsCleanup

Discussion in 'Scripting' started by GodHand, Sep 18, 2019.

  1. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    895
    30
    This is why advanced functions/scripts/modules have header data that details what everything does. As an example, for Start-WindowsCleanup, under '.NOTES', the following has been present since the option to clean-up the Component Store was added:

    Likewise, Start-WindowsCleanup actually requires input verification before it performs an image base reset. Ultimately, it is the end-user's decision to select the 'Yes' button despite all of the documented information within the function itself and is not a fault of the function itself, as some users do not require Windows Update and use other methods for integrating updates.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    895
    30
    I am not 100% sure, as I have only used it on Windows 10 and Windows Server 2016/2019. Considering the Windows Management Framework 5.1 that you can get from Microsoft includes PowerShell 5 and its cmdlets, I'm inclined to say that it would work, though I cannot say for certain if every removal process would work as intended.

    You could try running it with just the minimal amount of removals first and if it completes without issue, try some of the more advanced removal options.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Makinenn

    Makinenn MDL Junior Member

    Dec 7, 2010
    62
    30
    0
    Thank you for answering. I'll try to run it and see what happens.
     
  4. zbigniew59

    zbigniew59 MDL Member

    May 14, 2016
    190
    78
    10
    #84 zbigniew59, Aug 31, 2020
    Last edited: Aug 31, 2020
  5. GodHand

    GodHand MDL Addicted

    Jul 15, 2016
    534
    895
    30
    Updated 12/06/2020
    - A new registry key gets added that contains both the function's last run time as well as the StateFlags integer value. Each time the function is run, it checks this registry key and ensures none of the previous StateFlags' integer values are still present. This will ensure any set StateFlags integer values are removed if the clean-up process is exited or closed before the Windows Disk Clean-up utility has completed.
    - Included the removal of additional histories and recent documents.
    - Additional primary function and helper function updates and improvements.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...