I shared this link as part of my VMware Horizon View – Resource Dump post, but there is a section of it that I thought deserved special attention.
The full origional post is here if you wish to review it: VMware View 5.x – Windows 7 Golden Image
Specifically, the final step in the post contains very good information on how to “Clean up the machine”. I’ve adopted this process in my own environments to prepare Windows 7 gold master virtual machines for cloning, and I highly recommend it.
Important notes: These steps assume you’ve fully patched, installed all third-party software, made all necessary changes, and are fully prepared to finalize your gold master VM for deployment. These steps should be repeated every time changes are made to the gold master VM before creating a new snapshot and recomposing your desktop pools.
On your gold master virtual machine, perform the following to finalize it for deployment:
- Open an elevated command prompt
- Enter and run:
*Depending upon your OS version and .NET Framework versions installed, the exact folder containing ngen.exe may be different. I recommend that you verify this path prior to running these commands.
According to the referenced post, “This (command) will precompile all .NET assemblies which might still be queued”. If this is the first time this command has been run on this system you may see it run through a series of tasks that can take several minutes to complete, but it’s also normal to receive a simple “All compilation targets are up to date” message.
- If the OS is 64-bit, run the same command again but from the Framework64 folder.
- Browse to and delete all contents of C:\Windows\SoftwareDistribution\Download
- Run the following to clear all of the system event logs:
- wevtutil el >a.txt
- for /f %x in (a.txt) do wevtutil cl %x
- del a.txt
- Run Disk Cleanup on drive C: to remove unneeded files
- Defragment drive C:
*If you’ve followed VMware’s recommended optimizations for Windows 7, the Disk Defragmenter service is likely disabled. You will need to enable and start this service in order to defragment the disk, but be sure to disable it again before continuing.
- Release the IP address with ipconfig /release
- Flush the DNS cache with ipconfig /flushdns
- Shut down the VM and take a snapshot to use for cloning