the dism /cleanup-image /startcomponentcleanup /resetbase is supported in Windows 8 / Server 2012 and later only. Windows 7 and Windows Server 2008 R2 is not supported. However it can use the GUI Disk Cleanup Tool to cleanup the image. There's article on the TechNet to show how to cleanup the image for Windows Server 2008 R2. blogs.technet.com/b/askpfeplat/archive/2014/05/13/how-to-clean-up-the-winsxs-directory-and-free-up-disk-space-on-windows-server-2008-r2-with-new-update.aspx Also, you may need to use the "dism /export-image" or "dism /export-wim" command to reduce the size of the image file. Please note that if you have multiple indexes on the same .wim file you may need to export to the same filename by order.
i have done this diskcleanup with windows 7 before capturing the image. the size didnt decrease but increase.
The system needs to restart once first to apply the clean up for the component store for Windows 7 or Server 2008 R2 OS. Otherwise there'll be the pending files to start the cleanup when you do the next restart.
It's the same thing to use the "dism /export-image" command which is only supported on Windows 8 or later, for Windows 7 and Windows 7 AIK the "dism /export-wim" command is used.