create table #a(a varchar(8000) null) exec master..xp_cmdshell 'wmic cpu>c:\cpu.txt' bulk insert #a from 'c:\cpu.txt' declare @start int, @finish int select @start=charindex('ProcessorId', a), @finish=charindex('ProcessorType',a) from #a where a like '%ProcessorType%' select distinct substring(a, @start, @finish-@start) ProcessorID from #a where a not like '%ProcessorType%' drop table #a
WMIC is a neat little command-line utility for WMI stuff. I'll leave it as an exercise for the reader to get the hard drive IDs.