If you want to factory reset Windows Server 2022, you can refer to this post. There are 3 methods with step-by-step instructions.