Short answer:
Windows 10 and 11 you can't even if you have a license key. You need to reinstall or "upgrade" with a standard ISO.
Windows 10 LTSC you probably can
Windows server you can.. under conditions.
Long answer:
Windows 10 and 11 eval can not be converted from eval to standard with just a key or in any other way. Formatting and reinstalling a full ISO is the only way to my knowledge.
LTSC has a way but you didn't ask for LTSC so...
Windows server is complicated because it depends on the role and services run (no active domain controller or NIC teaming, etc) as well as the edition of the server.
For eval 2019 to standard server 2019, you need a GVLK key and can try this:
dism /online /set-edition:ServerStandard /productkey:N69G4-B89J2-4G8F4-WWYCC-J464C /accepteula
For eval 2022 to standard server 2022, you again need a GVLK key and can try
dism /online /set-edition:ServerStandard /productkey:N69G4-B89J2-4G8F4-WWYCC-J464C /accepteula
Now you may see some errors but that often has to do with the Software Protection Service and probably the server being on the internet. Disconnect the internet and stop that service and try again. Also, keep in mind a lot will depend n what services you have activated. If you have a domain running, you need to demote it to a member, which may cause more problems... and so on. If the admin also has messed with other services, no one can tell how it will go.
You can also just extend the trial period (you can up to 5 times) till you are ready to install a full version. That is a good 3 years of trial.
I personally tried it 2 times, one worked, one didn't and I just extended the trial periods cause I could not tell what the previous admin did, till I was ready to switch to a full production server.
For more, you need to search on the net and also have a test server to try any steps you may find. This exceeds our scope as a forum.