Determine System Model

From SQL Server Wiki
Jump to navigation Jump to search

see *https://twitter.com/SterbalRobert/status/773898107037835264

Glenn Berry (@GlennAlanBerry) Is there a good way of telling if a machine is a VM from the DMVs?

One Line version

if (object_id('tempdb..#ServerInfo') is not null) drop table #ServerInfo create table #ServerInfo (Logdate varchar(50), ProcessInfo varchar(256), Model varchar(1000)) insert into #ServerInfo(LogDate,ProcessInfo,Model) EXEC ('sys.xp_readerrorlog 0, 1, N''Manufacturer''') select model 'System Manufacturer and System Model (virtual machines are VMWare)' from #ServerInfo -- EXEC ('sys.xp_readerrorlog 0, 1, N''Manufacturer''')

Block Version

if (object_id('tempdb..#ServerInfo') is not null) drop table #ServerInfo 
create table #ServerInfo (Logdate varchar(50), ProcessInfo varchar(256), Model varchar(1000)) 
insert into #ServerInfo(LogDate,ProcessInfo,Model) 
EXEC ('sys.xp_readerrorlog 0, 1, N''Manufacturer''') 
select model 'System Manufacturer and System Model (virtual machines are VMWare)' 
from #ServerInfo 
-- EXEC ('sys.xp_readerrorlog 0, 1, N''Manufacturer''')