This same process works for changing the product key in Windows 8, Windows 10, or Windows 11.
There are a lot of legitimate reasons, especially in an enterprise setting, when you need to be able to quickly (and sometimes programmatically) change the product key on a Windows client.
Thankfully the process is pretty simple.
First, open Command prompt (as Administrator)
slmgr.vbs -ipk YOUR-KEY-HERE