The Sysocmgr.exe utility allows you to add or remove Windows components from the command line. It supports the following command-line switches, which you may use in your scripts:
/i:inf path (path to Sysoc.inf file]
/u:answer file path (path to answer file)
/q (quiet mode)
/r (suppress reboot)
For more details and the formatting required for the answer file, see Microsoft KB article 222444.