Reputation: 3
I'm Looking for a way to find the system model like "Proliant DL580 Gen9", but I can't found any way to gain this.
I try below query and used the "master.sys.xp_regread" procedure to get the server model name
DECLARE @ServerType VARCHAR(max)
EXEC master.sys.xp_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'HARDWARE\DESCRIPTION\System\BIOS\0',
@value_name = 'SystemProductName',
@value = @ServerType OUTPUT;
SELECT @ServerType
which returns the NULL
value!
Is there a way to get the system model like "Proliant DL580 Gen9"?
Thanks.
Upvotes: 0
Views: 509
Reputation: 3
Thank you for answering my question Also I found another way to get this property.
DECLARE @SysInfo TABLE (Property NVARCHAR(MAX));
INSERT INTO @SysInfo (Property)
EXEC master.dbo.xp_cmdshell 'systeminfo | findstr /C:"System Model"';
SELECT (SELECT LTRIM(REPLACE(Property, 'System Model:', ''))
FROM @SysInfo WHERE Property LIKE '%System Model%');
Best Regards
Upvotes: 0
Reputation: 2434
Good day,
You can get the model using the query bellow:
EXEC master.sys.xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'HARDWARE\DESCRIPTION\System\BIOS',
@value_name = 'SystemProductName'
GO
The result should give you the equivalent information which you get by executing the wmic command
wmic computersystem get model
For anything that you are not sure, you can simply open the registry using the command regedit, find the value which you are looking for, and change the parameters in the query above
For example here are some common values which people need:
EXEC master.sys.xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'HARDWARE\DESCRIPTION\System\BIOS',
@value_name = 'SystemManufacturer'
GO
EXEC master.sys.xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'HARDWARE\DESCRIPTION\System\BIOS',
@value_name = 'SystemVersion'
GO
EXEC master.sys.xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'HARDWARE\DESCRIPTION\System\BIOS',
@value_name = 'SystemProductName'
GO
EXEC master.sys.xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'HARDWARE\DESCRIPTION\System',
@value_name = 'SystemBiosVersion'
GO
Upvotes: 1