Ofcourse it only works if your cd is used for unattended installs. Which means that it installs itself with predefined settings in the unattended.txt. And you have to put the code in there.
Else use Use keyfinder (magical jelly bean) as mentioned by @ksiemb
You can try belarc too....but all these are for installed machines...