Step 1: You open cmd (run as administrator), then you type
dism /online /get-targeteditions
Step 2: You copy and paste this code in cmd
If you want to upgrade to Windows Server 2022 Stardard you type:
dism /online /set-edition:serverstandard /productkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /accepteula
if you see “upgrade failed”, you restart your Windows Server 2022. It will upgrade Windows Server 2022 Evaluation to Stardard.