How to check if a machine is physical or virtual



If you connect to a remote machine through remote desktop protocol, you might not always know whether that machine is virtual or physical. If you would like to find out whether the machine you have connected to is virtual or physical, there are several ways to go about that.

1. Check System Tray

The quickest method is to check in the system tray, usually you will find an icon for the utilities the manufacturer of the virtualization product, provide to enhance the performance of the virtual machine’s guest operating system. Such as VMware Tools.

virphys1 Icon for VMware Tools in the system tray.

2. Check Programs and Features in Control Panel

Another method is to check Programs and Features in Control Panel. You will find out if VMware Tools are installed or not.
virphys2

3. Check System Information

Click Start → Write msinfo32 → press Enter
virphys3
The System Manufacturer and System Model items will let you know whether the machine is physical or Virtual.

4. Use Powershell or Command Prompt

In Powershell you can use the following cmdlet get-wmiobject win32_computersystem | fl model
virphys4

And in the Command Prompt, use this command systeminfo /s %computername% | findstr /c:"Model:" /c:"Host Name" /c:"OS Name"
virphys6

5. Check All Servers in a Domain

Sometimes you might want to know this information about all servers in a domain, so how do you go about that? Simple, use the following Powershell script

import-module activedirectory
get-adcomputer -filter {operatingsystem -like "windows server*"} | select-object name | export-csv .\computers.txt -notypeinformation -encoding UTF8
(Get-Content .\computers.txt) | % {$_ -replace '"', ""} | out-file -FilePath .\computers.txt -force -encoding ascii
$computers= get-content .\computers.txt | select -Skip 1
Foreach($computer in $computers){systeminfo /s $computer | findstr /c:"Model:" /c:"Host Name" /c:"OS Name" | out-file -FilePath .\VirPhys.txt -append }

You will get an output like this in a file called VirPhys.txt (located in the same location as you ran the script)
virphys7

As you can see, Server01, Server03 and Server05 are virtual machines, while Server02 and Server04 are physical ones.

4 Comments

  1. Jeff

    Excellent script! Saved me tons of time! Clicked a few ads on ur site, u definitely deserve the revenue lol 😀

    Reply
  2. Howard

    Excellent commands. I particularly like the systeminfo command because you can run it on any computer without having to remote into it.

    Thanks!

    Reply
  3. Vimala

    Great! Simple commands and got the expected output.
    Thanks!!

    Reply
  4. Mohammed Azhar

    Perfect ..!

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload the CAPTCHA.