Activate Windows from command line

Activating Windows from cmd usually takes two steps using slmgr.vbs tool:

Local Machine

Step 1: Change product key to valid one

slmgr /ipk XXX-YOUR-VALID-WIN-CODE-XXX

Step 2: Run online activation

slmgr /ato

If you prefer single-line command:

slmgr /ipk XXX-YOUR-VALID-WIN-CODE-XXX&&slmgr /ato

Process does take some time, so be patient.

Remote Machine

Same can be achieved on a remote machine, but success may vary depending on the permission/network settings:

slmgr 192.168.100.100 admin-user password /ipk XXX-YOUR-VALID-WIN-CODE-XXX
slmgr /ato

Your (usually volume licensed) PC should now be activated.