Saturday, September 14, 2013

Find out the Virtual machine or physical machine of the server


1.Using Services
2.1 Go to start ---->run type  Services.msc open ----> then look for "VMWare services"  running or not.
     If it VMWare server then it will show up "VMware Tools Service" ----> it should  "started"
    --VMware Tools Service

3.Using Windows command prompt: Is the Physical server or VMware Server:
Run the systeminfo command @ command prompt see the system menufacturer n system model details. There you can find the virtual and physical machine information.

4.Using SQL Server: Run below
declare @Virtualname varchar(255)
declare @Virtual varchar(255)
create table #OSinfo(OSinfo varchar (255))
insert into #OSinfo
exec master..xp_cmdshell 'systeminfo'
set @Virtualname =(select ltrim(SUBSTRING(OSinfo,CHARINDEX(' ',OSinfo),LEN(OSinfo)))
from #OSinfo
where OSinfo like '%system%' and OSinfo like '%manufacture%')

if (@Virtualname not like '%virtual%')
begin
set @Virtual='Not Virtual'
set @Virtualname='Not Virtual'
end
else
begin
set @Virtual='Virtual'
end
print @Virtualname
print @Virtual

Run the below and look for  System Model:
select * from #OSinfo    -- example: System Model: VMware Virtual Platform
Drop table #OSinfo

5. If it SQL Server 2008 R2:
SELECT @@SERVERNAME AS SRVName,virtual_machine_type FROM sys.dm_os_sys_info
--The virtual_machine_type attribute is a new addition to this DMV as of SQL 2008 R2.
  There are three possible values: 0,1, or 2.  The value of 0 means that the machine is physical.
  Any other value means that it is a virtual machine.  You can read more about that from MSDN.







No comments:

Post a Comment