The easiest way to do this is with the following command:
Vista:
slmgr.vbs -skms <server's FQDN>
Windows 7:
slmgr.vbs /skms <server's FQDN>
Alternatively, you can specify a product key:
slmgr.vbs /ipk <Your product key>
Note 1: You should run this with elevated administrator permissions.
Note 2: This does not actually activate the computer. Activation will happen within about 2 hours automatically, or you can run the following command:
Vista:
slmgr.vbs -ato
Windows 7:
slmgr.vbs /ato
– Main.FredPettis - 2010-08-14