I am creating a program that detects if the current machine is a virtual machine (of software like VMware, VirtualBox, etc.) or a host computer for Windows. However, I could not find any code online so I asked ChatGPT and it gave me this script:
<code>import os
if not 'hyper v' in os.popen('systeminfo').read().lower():
print('Not a virtual machine!')
else:
print('Is a virtual machine!')
</code>
<code>import os
if not 'hyper v' in os.popen('systeminfo').read().lower():
print('Not a virtual machine!')
else:
print('Is a virtual machine!')
</code>
import os
if not 'hyper v' in os.popen('systeminfo').read().lower():
print('Not a virtual machine!')
else:
print('Is a virtual machine!')
(Might be not 100% correct because my virtual machines are broken)
But I think there is a more efficient and faster way to do it.
2