You can run the OS Optimization Tool tool from the command line.

Run the command prompt as administrator and use the appropriate options.

VMwareOSOptimizationTool.exe ^

[-h] ^

[-v] ^

[-optimize|-o] ^

[-generalize|-g] ^

[-finalize|-f] ^

[-reboot|-shutdown]

where

Parameter Description
-h Displays command line help.
-v Enables verbose mode and displays detailed messages.
-optimize|-o Optimizes the image.

For information on optimization parameters, see Optimization Parameters.

-generalize|-g Generalizes Windows by running sysprep.
-finalize|-f Performs cleanup tasks and clears up the specified information.
-reboot Restarts the computer after all operations have completed.
-shutdown Shuts down the computer after all operations have completed.