命令行查看硬件信息

日常使用中遇到盘点资产的场景,往往需要通过搬出来主机或者显示器,查看标签确认序列号、维保信息等;遇到服务器可能还需要去到机房去核对标签,有没有快速准确的方式,通过命令行(批处理或者shell脚本)快速获取硬件信息呢?参考如下步骤可以快速解决该问题:

Windows主机或服务器

CMD或者批处理通过WMIC查询

1.查看硬件厂商,型号,序列号

wmic csproduct list brief
————————————————————————————————————————————

Caption         IdentifyingNumber  Name               Vendor     Version
计算机系统产品  6****2            OptiPlex 7490 AIO  Dell Inc.

2.查看设备bios信息

wmic bios list brief
————————————————————————————————————————————————————————————
Manufacturer  Name    SerialNumber  SMBIOSBIOSVersion  Version
Dell Inc.     1.11.1  6****2       1.11.1             DELL   - 2

3.查看设备cpu信息

wmic cpu list brief
————————————————————————————————————————————————————————————————————————————————————
Caption                                DeviceID  Manufacturer  MaxClockSpeed  Name                                      SocketDesignation
Intel64 Family 6 Model 165 Stepping 3  CPU0      GenuineIntel  3192           Intel(R) Core(TM) i5-10505 CPU @ 3.20GHz  U3E1 

4.查看设备内存信息

wmic memorychip list brief
——————————————————————————————————————————————————————————————————————————————————
Capacity    DeviceLocator  MemoryType  Name      Tag                TotalWidth
8589934592  DIMM1          0           物理内存  Physical Memory 0  64
8589934592  DIMM2          0           物理内存  Physical Memory 1  64

5.查看显示器信息

wmic desktopmonitor list brief
———————————————————————————————————————————————————————————————————————————————————————————
DeviceID         DisplayType  MonitorManufacturer  Name                      ScreenHeight  ScreenWidth
DesktopMonitor1               Dell Inc.            Dell P2214H(DisplayPort)  1080          1920

通过powershell查看wmic相关信息

Get-CimInstance -Query 'Select * from Win32_DisplayControllerConfiguration'
————————————————————————————————————————————————————————————————————————————

Caption                      : Intel(R) UHD Graphics 630
Description                  : Intel(R) UHD Graphics 630
SettingID                    : Intel(R) UHD Graphics 630
BitsPerPixel                 : 32
ColorPlanes                  : 1
DeviceEntriesInAColorTable   : 4294967295
DeviceSpecificPens           : 4294967295
HorizontalResolution         : 1024
Name                         : Intel(R) UHD Graphics 630
RefreshRate                  : 60
ReservedSystemPaletteEntries :
SystemPaletteEntries         :
VerticalResolution           : 768
VideoMode                    : 1024 by 768 pixels, True Color, 60 Hertz
PSComputerName               :

其中红色部分可以根据W32提供程序进行自由组合

Win32 提供程序 - Win32 apps | Microsoft DocsMicrosoft&\#160;Win32 提供程序检索和更新与Windows系统相关的数据,&\#8212;环境变量的当前设置和逻辑磁盘的属性等数据。https://docs.microsoft.com/zh-cn/windows/win32/cimwin32prov/win32-provider

1.查找大类

2.锁定细分小类

3.替换关键字即可(不要覆盖单引号)

Get-CimInstance -Query 'Select * from Win32_DesktopMonitor'
———————————————————————————————————————————————————————————————————————————————————————————

DeviceID        Name                     DisplayType MonitorManufacturer ScreenHeight ScreenWidth
--------        ----                     ----------- ------------------- ------------ -----------
DesktopMonitor1 Dell P2214H(DisplayPort)             Dell Inc.           1080         1920

systeminfo可以查看系统状态信息,可以通过findstr过滤需要的信息

systeminfo |findstr 启动
————————————————————————————————————
系统启动时间:     22/8/10, 20:02:03

 Linux服务器硬件信息查询

均需要sudo或者root权限

1.查看硬件厂商

dmidecode -s system-manufacturer

2.查看设备型号

dmidecode -s system-product-name

3.查看设备序列号

dmidecode -s system-serial-number

dmidecode --help可以查看其他使用方式

ESXi服务器硬件信息查询

1.cli查询,ssh登陆esxi直接查询

esxcli hardware platform get

2.WEB页面查询

VC或者ESXi查询界面均有,VC对应进入主机,配置,硬件,处理器,服务标记(对应设备序列号)

ESXi对应主机→系统信息→序列号

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Qwier

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值