Cleanup unwanted files from the reference machine during Image Capture

Hello Friends, how are you doing today?

While capturing the WIM file, the Build Engineer has to clean the temp files created during the Image customization.

Also need to perform the System drive cleanup for defragmenting and windows update cleanup.

We have a simple solution to perform Image cleanup by executing the below batch script.

Cleanup unwanted files from the reference machine during Image Capture

 @echo off

Title Script is written by Dashrath Chate to cleanup unwanted files from referance machine

net stop wuauserv

RMDIR /S /Q %windir%\SoftwareDistribution

RMDIR /S /Q C:\Perflogs

net start wuauserv

del /s /f /q %userprofile%\Recent\*.*

del /s /f /q C:\Windows\Prefetch\*.*

del /s /f /q C:\Windows\Temp\*.*

del /s /f /q %USERPROFILE%\appdata\local\temp\*.*

del %TEMP%\*.* /f /s /q

vssadmin delete shadows /for=C: /all /Queit

powershell.exe disable-computerrestore -drive C:

No comments:

Post a Comment

Leave your valuable words here for improve better.