用powershell写一段代码取得电脑上所有硬件信息,包括BIOS,EC,Chipset,CPU,Camera,FingerPrint,WLAN,BT,ODD,硬盘,内存,BaseBord
时间: 2024-06-09 20:11:20 浏览: 160
WMI.zip_wim_wim获取系统信息、硬件信息_wmi
以下是使用 PowerShell 获取电脑上所有硬件信息的代码:
```powershell
# 获取 BIOS 信息
Get-WmiObject -Class Win32_BIOS
# 获取 EC 信息
Get-WmiObject -Class Win32_EC BIOSVersion
# 获取 Chipset 信息
Get-WmiObject -Class Win32_ChipSet
# 获取 CPU 信息
Get-WmiObject -Class Win32_Processor
# 获取摄像头信息
Get-WmiObject -Class Win32_USBControllerDevice |
Where-Object {$_.Dependent -like '*WebCam*'} |
ForEach-Object {
$usbDevice = ([wmi]($_.Antecedent))
$usbDevice | Select-Object -Property DeviceID, Description
}
# 获取指纹识别信息
Get-WmiObject -Class Win32_BiometricSensor
# 获取 WLAN 信息
Get-WmiObject -Class Win32_NetworkAdapter |
Where-Object {$_.AdapterTypeId -eq 0 -and $_.NetConnectionStatus -eq 2} |
Select-Object -Property Name, MACAddress, AdapterType, Manufacturer, DriverVersion
# 获取蓝牙信息
Get-WmiObject -Class Win32_PnPEntity |
Where-Object {$_.Name -like '*Bluetooth*'} |
Select-Object -Property Name, Manufacturer, DriverVersion
# 获取 ODD 信息
Get-WmiObject -Class Win32_CDROMDrive
# 获取硬盘信息
Get-WmiObject -Class Win32_DiskDrive
# 获取内存信息
Get-WmiObject -Class Win32_PhysicalMemory
# 获取主板信息
Get-WmiObject -Class Win32_BaseBoard
```
以上代码中,每个 `Get-WmiObject` 命令都对应着一种硬件类型,通过调用相应的 WMI 类获取信息。你可以根据需求选择相应的信息进行获取。
阅读全文