question

RaimondiAnthonyCognizant-1354 avatar image
0 Votes"
RaimondiAnthonyCognizant-1354 asked RaimondiAnthonyCognizant-1354 commented

Windows 10 cleanup with powershell

Hi Guys

Do you have any good PowerShell scripts to cleanup Windows 10 harddrives? I try the cleanmgr but no matter what I do it doesn't clean the "Windows Update Cleanup" option. I need to create a script that I can run on VDIs when they get under 10 GB

windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered RaimondiAnthonyCognizant-1354 commented

How about a DISM cleanup?

 Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Will this effect the users data?

0 Votes 0 ·
MotoX80 avatar image MotoX80 RaimondiAnthonyCognizant-1354 ·

No, but the /ResestBase switch will prevent any updates from being uninstalled.

https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/clean-up-the-winsxs-folder

0 Votes 0 ·
AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered RaimondiAnthonyCognizant-1354 commented

Hi @RaimondiAnthonyCognizant-1354 ,

maybe this help:
https://www.jaapbrasser.com/diskcleanup-remove-previous-windows-versions-powershell-module/


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Andreas

Im not looking to remove previous versions. Basically I can do the cleanup but the "Windows Update Cleanup" under the cleanmgr.exe(Disk Cleanup under Clean System Files ) doesnt get removed and there's always a ton of data in there

0 Votes 0 ·
IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered RaimondiAnthonyCognizant-1354 commented

Hi,

Does this help?

https://github.com/hematic/Server-OS-Drive-Cleanup-Script/


Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Ian

No it didnt clean those folders. Thank you I will continue to work on it

0 Votes 0 ·