Type cmd in the search bar, then right click and 'Run as administrator'

In the terminal type:

slmgr.vbs /ipk KEY
slmgr.vbs /ato

Where KEY is your legitimate Windows 10 key.

Best,