My good friend Dan wrote a great blog entry about automating the installation of the required Windows OS prerequisites for an Exchange 2010 install.  You can read it here

Over and above this, Exchange 2010 SP1 adds a new setup switch

 /InstallWindowsComponents

Exchange 2010 SP1 Setup has been improved to allow you to install the required Windows roles and features. If you select the option to install Windows roles and features, progress is shown and the appropriate roles and features are installed. If a reboot is required, you will have to reboot the server and launch Setup again. When Setup is launched again, Setup will resume where it left off. If you don’t select the option to install Windows roles and features, you can manually install the Windows roles and features and continue Setup after the prerequisites are met.

 

For example, to install the CAS,MBX and HUB roles auto-magically run:

 

setup.com /Mode:Install /Roles:Mailbox,ClientAccess,HubTransport /InstallWindowsComponents

 

 

And to do the same with less typing (though the /M switch could also be dropped):

setup.com /M:Install /Roles:M,C,H  /InstallWindowsComponents

 

TechNet has the full prerequisites listed here

 

As an added bonus, you can also do this on the upgrade from Exchange 2010 RTM to SP1:

Setup.com /m:upgrade /InstallWindowsComponents

 

Cheers,

Rhoderick