It works the same with a virtual machine.
The Windows product key is licensed against the virtual machine hardware.
So wiping out an install of Windows and re-install from scratch and have it activated should work. I've done it several times myself.
However note that it is a good idea to make a backup of your VM before you do this.
Also note that if you copy a VM to another location (with no snapshots, VM shut down, VMware Workstation not running) that as soon as you start that VM, VMware Workstation will ask "did you copy or move"... as long as you answer "move" your virtual hardware will stay unchanged.
As soon as you select "copy" it will get new hardware ID's.
Wil| Author of Vimalin. The virtual machine Backup app for VMware Desktop Products
| Vimalin : Automated backups for VMware Fusion and VMware Workstation Professional
| More info at https://www.vimalin.com
| Twitter @wilva
| VMware Wiki at http://www.vi-toolkit.com
Perhaps there is a misunderstanding.
I'm not talking about formatting a VM and always reinstalling Win 10.
In this case, the PK is probably retained
I'm talking about completely removing the VM. deleting it from ESXi or Workastion.
But recovering the P.K., so I am able to use it again in a new VM, perhaps on a different server.
The references of the P.K. they will also be saved somewhere and since it is not a physical PC it will be inside some configuration files