Yes, with UseTrial() use the TA_DISALLOW_VM flag (so, either TA_USER | TA_DISALLOW_VM or TA_SYSTEM | TA_DISALLOW_VM)
With product key make sure you've disabled VM activations in the interface. See: Licensing from inside a virtual machine or hypervisor