Is there a way to know if the Windows machine I'm working on is virtual or physical? (I'm connecting with RDP to the machine. If it's a virtual machine it is working and handled by VMWare).
In Linux you can also use "virt-what". "virt-what - detect if we are running in a virtual machine".
If you are in Windows, as castrocra says, you can run the
systeminfo command from inside a cmd shell, then look for the "BIOS Version".
These are probably real machines:
BIOS Version: Dell Inc. A03, 06/12/2010 BIOS Version: Phoenix Technologies, LTD MS7254 1.08, 08/03/2007
This, on the other hand, is almost certainly a virtual machine:
BIOS Version: VMware, Inc. VMW71.00V.0.B64.1201040214, 04/01/2012
It has been answered, but FWIW you can do this in powershell:
gwmi -q "select * from win32_computersystem"
The "Manufacturer" will be "Microsoft Corporation" and the "Model" will be "Virtual Machine" if it's a virtual machine, or it should display regular manufacturer details if not, e.g. "Dell Inc." and "PowerEdge R210 II" respectively.
You could try the "Host Detection" program.
If it's a Unix VM, use imvirt. It's a Perl script that detects VMWare, Xen, and several others.
One (relatively) simple way to detect key virtualization information is via WMI / WBEM. You can use the root\CIM2 namespace and access the Baseboard class (full of interesting BIOS information) to get a description of the "physical" system. This class often includes information about the motherboard and chassis - manufacture, model, serial number, other.
Run the following command from a command prompt or PowerShell session:
wmic baseboard get manufacturer, product, Serialnumber, version
There is another option here which describes the official way to do so:
Click Start > Run. Type msinfo32 and press Enter. In the right pane, look for System Manufacturer for 'VMware, Inc.'
nbtstat -a The outcome will tell you as VMs have a speecific prefix which is 00-50-56-XX-XX-XX. There is also another prefix it uses but I can not remember at the top of my head but I recall Vcenter uses 00-50-56-XX-XX-XX so this ios the one I check only.
I think this is the best way, personally.