Computer Model Counts Query

  • 29 March 2023
  • Sean Huggans

Query will list computer model counts in your environment, successfully handling Lenovo sytem model names. It also normalizes vendor names to avoid duplicate model lines (IE "HP" and "Hewlett-Packard" are both merged into "HP"). Sorted from largest count to lowest. This is intended for use in a report, but can be useful standalone also.

Query: 
SELECT 
COUNT(*) AS RecNum,
  CASE CS.Manufacturer0
    WHEN 'Hewlett-Packard' THEN 'HP'
	WHEN 'Dell Inc' THEN 'DELL'
	WHEN 'Dell, Inc' THEN 'DELL'
	WHEN 'Dell, Inc.' THEN 'DELL'
	WHEN 'Dell Inc.' THEN 'DELL'
	WHEN 'DELL__' THEN 'DELL'
	WHEN 'Intel Corporation' THEN 'INTEL'
	WHEN 'Intel(R) Client Systems' THEN 'INTEL'
	WHEN 'To be filled by O.E.M.' THEN 'MISSING'
	WHEN 'System manufacturer' THEN 'MISSING'
	WHEN 'Default string' THEN 'MISSING'
	WHEN 'Microsoft Corporation' THEN 'MICROSOFT'
	WHEN 'Microsoft Corp' THEN 'MICROSOFT'
	WHEN 'VMware, Inc.' THEN 'VMWARE'
	WHEN 'Panasonic Corporation' THEN 'PANASONIC'
	WHEN 'Panasonic Corp' THEN 'PANASONIC'
	WHEN 'Gigabyte Technology Co., Ltd.' THEN 'GIGABYTE'
	WHEN 'TANGENT COMPUTER' THEN 'TANGENT'
	WHEN 'Supermicro' THEN 'SUPERMICRO'
	WHEN 'Cybernet Manufacturing Inc.' THEN 'CYBERNET'
	WHEN 'Eurotech, Inc.' THEN 'EUROTECH'
	WHEN 'Touch Dynamic Inc.' THEN 'TOUCH DYNAMIC'
	WHEN 'Dedicated Computing' THEN 'DEDICATED COMPUTING'
	WHEN 'Omni Tech Corp' THEN 'OMNITECH'
	WHEN 'Advantech Co.,Ltd.' THEN 'ADVANTECH'
	ELSE CS.Manufacturer0
  END AS 'Manufacturer',
  CS.Model0 AS 'Machine Model'
FROM  
  v_GS_COMPUTER_SYSTEM CS
WHERE
  CS.Manufacturer0 NOT LIKE 'Lenovo'
GROUP BY 
 CS.Manufacturer0, 
 CS.Model0
 
UNION
 
SELECT COUNT(*) AS RecNum,
 CS.Vendor0 AS 'Manufacturer', 
 CS.Version0 AS 'Machine Model'
FROM  
  v_GS_COMPUTER_SYSTEM_PRODUCT CS
WHERE
	CS.Vendor0 LIKE 'Lenovo'
GROUP BY 
 CS.Vendor0,
 CS.Version0
ORDER BY RecNum DESC, [Manufacturer] ASC, [Machine Model] ASC
Query Type: 
SQL Query
Error | visuaFUSION Systems Solutions Blog

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /mnt/home/visuafus/public_html/bahusa.net/includes/common.inc:2861) in drupal_send_headers() (line 1551 of /mnt/home/visuafus/public_html/bahusa.net/includes/bootstrap.inc).
  • Error: Call to undefined function mail() in DefaultMailSystem->mail() (line 79 of /mnt/home/visuafus/public_html/bahusa.net/modules/system/system.mail.inc).

Error

The website encountered an unexpected error. Please try again later.