HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Physical Server or a Virtual Machine SQL Server?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
serversqlmachinephysicalvirtual

Problem

Is there a anyway to figure out via a SQL Script to know whether SQL Server is running on a Physical Server or Virtual Server ?

Solution

If you are using SQL Server 2008 R2 RTM or older then there is a CMD Command "SYSTEMINFO" which has information about System model.

OR

If cmdshell is enabled on instance then you can execute it from SQL Server Management Studio.

DECLARE @result int
EXEC @result = xp_cmdshell 'SYSTEMINFO'


System Manufacturer: VMware, Inc.

System Model: VMware Virtual Platform

New columns (virtual_machine_type, virtual_machine_type_desc) in DMV sys.dm_os_sys_info are introduced in SQL Server 2008 R2 Service Pack 1

Link

Code Snippets

DECLARE @result int
EXEC @result = xp_cmdshell 'SYSTEMINFO'

Context

StackExchange Database Administrators Q#81352, answer score: 7

Revisions (0)

No revisions yet.