使用Windows PowerShell来查看硬件信息

早上,研究了下WINDOWS下的PowerShell。

觉得还不错。

下面讲下,使用PowerShell来查看硬件信息:

1.      查看计算机BIOS信息
我们首先来检查一下计算机的BIOS信息,BIOS就是基本输入输出系统,是在操作系统运行之前,对计算机进行检查设置的第一个软件。BIOS信息主要就是BIOS的类型、版本等,你可以使用如下命令来查看本地计算机上的Bios信息:
 
PS C:\> Get-WmiObject -Class Win32_BIOS
SMBIOSBIOSVersion : 080015
Manufacturer      : American Megatrends Inc.
Name              : RS780D BIOS Date: 02/27/09 11:03:04 Ver: 08.00.15
SerialNumber      : To Be Filled By O.E.M.
Version           : 022709 - 20090227

 
这里你可以看到,生产商是American Megatrends,版本是022709 - 20090227的。
2.      查看计算机内存信息
内存信息往往是我们需要关注的地方,如何能够知道计算机的内存信息?您可以使用如下的命令:
PS C:\> Get-WmiObject -Class Win32_PhysicalMemory
__GENUS              : 2
__CLASS              : Win32_PhysicalMemory
__SUPERCLASS         : CIM_PhysicalMemory
__DYNASTY            : CIM_ManagedSystemElement
__RELPATH            : Win32_PhysicalMemory.Tag="Physical Memory 0"
__PROPERTY_COUNT     : 30
__DERIVATION         : {CIM_PhysicalMemory, CIM_Chip, CIM_PhysicalComponent, CIM_PhysicalElement...}
__SERVER             : HUBING
__NAMESPACE          : root\cimv2
__PATH               : \\HUBING\root\cimv2:Win32_PhysicalMemory.Tag="Physical Memory 0"
BankLabel            : BANK0
Capacity             : 2147483648
Caption              : Physical Memory
CreationClassName    : Win32_PhysicalMemory
DataWidth            : 72
Description          : Physical Memory
DeviceLocator        : DIMM0
FormFactor           : 8
HotSwappable         :
InstallDate          :
InterleaveDataDepth  : 0
InterleavePosition   : 0
Manufacturer         : Manufacturer00
MemoryType           : 21
Model                :
Name                 : Physical Memory
OtherIdentifyingInfo :
PartNumber           : ModulePartNumber00
PositionInRow        : 1
PoweredOn            :
Removable            :
Replaceable          :
SerialNumber         : SerNum00
SKU                  :
Speed                : 400
Status               :
Tag                  : Physical Memory 0
TotalWidth           : 64
TypeDetail           : 128
Version              :

__GENUS              : 2
__CLASS              : Win32_PhysicalMemory
__SUPERCLASS         : CIM_PhysicalMemory
__DYNASTY            : CIM_ManagedSystemElement
__RELPATH            : Win32_PhysicalMemory.Tag="Physical Memory 1"
__PROPERTY_COUNT     : 30
__DERIVATION         : {CIM_PhysicalMemory, CIM_Chip, CIM_PhysicalComponent, CIM_PhysicalElement...}
__SERVER             : HUBING
__NAMESPACE          : root\cimv2
__PATH               : \\HUBING\root\cimv2:Win32_PhysicalMemory.Tag="Physical Memory 1"
BankLabel            : BANK1
Capacity             : 2147483648
Caption              : Physical Memory
CreationClassName    : Win32_PhysicalMemory
DataWidth            : 72
Description          : Physical Memory
DeviceLocator        : DIMM1
FormFactor           : 8
HotSwappable         :
InstallDate          :
InterleaveDataDepth  : 0
InterleavePosition   : 0
Manufacturer         : Manufacturer01
MemoryType           : 21
Model                :
Name                 : Physical Memory
OtherIdentifyingInfo :
PartNumber           : ModulePartNumber01
PositionInRow        : 1
PoweredOn            :
Removable            :
Replaceable          :
SerialNumber         : SerNum01
SKU                  :
Speed                : 400
Status               :
Tag                  : Physical Memory 1
TotalWidth           : 64
TypeDetail           : 128
Version              :
 
由于我使用的电脑有2根内存条.

当你看到内存容量是XXXXXXXXXX时候,是不是有点头痛呢?让我们再来简单编写一个脚本,计算计算机上的内存容量。代码如下:
PS C:\> Get-WmiObject -Class Win32_PhysicalMemory | %{$sum = 0} { $sum += $_.Capacity } {Write-Host ($sum / 1MB) "MB"}
4096 MB
 
原来计算机上有4GB的内存啊,真的是很方便。
3.      查看计算机处理器信息
很多时候,我们很好奇计算机上的处理器信息,例如:CPU的速度、时钟频率、缓存大小、CPU型号、CPU数量等。我们只要使用下面的命令就能了解计算机上的CPU信息啦:
PS C:\> Get-WmiObject -Class Win32_Processor
__GENUS                     : 2
__CLASS                     : Win32_Processor
__SUPERCLASS                : CIM_Processor
__DYNASTY                   : CIM_ManagedSystemElement
__RELPATH                   : Win32_Processor.DeviceID="CPU0"
__PROPERTY_COUNT            : 48
__DERIVATION                : {CIM_Processor, CIM_LogicalDevice, CIM_LogicalElement, CIM_ManagedSystemElement}
__SERVER                    : HUBING
__NAMESPACE                 : root\cimv2
__PATH                      : \\HUBING\root\cimv2:Win32_Processor.DeviceID="CPU0"
AddressWidth                : 32
Architecture                : 9
Availability                : 3
Caption                     : x64 Family 16 Model 2 Stepping 3
ConfigManagerErrorCode      :
ConfigManagerUserConfig     :
CpuStatus                   : 1
CreationClassName           : Win32_Processor
CurrentClockSpeed           : 2300
CurrentVoltage              : 15
DataWidth                   : 64
Description                 : x64 Family 16 Model 2 Stepping 3
DeviceID                    : CPU0
ErrorCleared                :
ErrorDescription            :
ExtClock                    : 200
Family                      : 231
InstallDate                 :
L2CacheSize                 : 1536
L2CacheSpeed                :
L3CacheSize                 : 2048
L3CacheSpeed                : 0
LastErrorCode               :
Level                       : 16
LoadPercentage              : 46
Manufacturer                : AuthenticAMD
MaxClockSpeed               : 2300
Name                        : AMD Phenom(tm) 8650 Triple-Core Processor
NumberOfCores               : 3
NumberOfLogicalProcessors   : 3
OtherFamilyDescription      :
PNPDeviceID                 :
PowerManagementCapabilities :
PowerManagementSupported    : False
ProcessorId                 : 178BFBFF00100F23
ProcessorType               : 3
Revision                    : 515
Role                        : CPU
SocketDesignation           : CPU 1
Status                      : OK
StatusInfo                  : 3
Stepping                    : 3
SystemCreationClassName     : Win32_ComputerSystem
SystemName                  : HUBING
UniqueId                    :
UpgradeMethod               : 1
Version                     : Model 2, Stepping 3
VoltageCaps                 : 
这里我做了一些删减,如果有多个CPU,那么每个CPU的这些信息都会被输出,确定CPU的数量也很容易,用下面的命令就能实现:
PS C:\> @(Get-WmiObject -Class Win32_Processor).count
1
 
4.      查看计算机显卡信息
PS C:\> Get-WmiObject -Class Win32_VideoController
__GENUS                      : 2
__CLASS                      : Win32_VideoController
__SUPERCLASS                 : CIM_PCVideoController
__DYNASTY                    : CIM_ManagedSystemElement
__RELPATH                    : Win32_VideoController.DeviceID="VideoController1"
__PROPERTY_COUNT             : 59
__DERIVATION                 : {CIM_PCVideoController, CIM_VideoController, CIM_Controller, CIM_LogicalDevice...}
__SERVER                     : HUBING
__NAMESPACE                  : root\cimv2
__PATH                       : \\HUBING\root\cimv2:Win32_VideoController.DeviceID="VideoController1"
AcceleratorCapabilities      :
AdapterCompatibility         : ATI Technologies Inc.
AdapterDACType               : Internal DAC(400MHz)
AdapterRAM                   : 268435456
Availability                 : 3
CapabilityDescriptions       :
Caption                      : ATI Radeon HD 3300 Graphics
ColorTableEntries            :
ConfigManagerErrorCode       : 0
ConfigManagerUserConfig      : False
CreationClassName            : Win32_VideoController
CurrentBitsPerPixel          : 32
CurrentHorizontalResolution  : 1024
CurrentNumberOfColors        : 4294967296
CurrentNumberOfColumns       : 0
CurrentNumberOfRows          : 0
CurrentRefreshRate           : 75
CurrentScanMode              : 4
CurrentVerticalResolution    : 768
Description                  : ATI Radeon HD 3300 Graphics
DeviceID                     : VideoController1
DeviceSpecificPens           :
DitherType                   : 0
DriverDate                   : 20090316213354.000000-000
DriverVersion                : 8.01.01.888
ErrorCleared                 :
ErrorDescription             :
ICMIntent                    :
ICMMethod                    :
InfFilename                  : oem1.inf
InfSection                   : ati2mtag_RS780D
InstallDate                  :
InstalledDisplayDrivers      : atiumdag.dll,atidxx32.dll,atidxx64,atiumdva.cap,atiumd64,atiumd6a,atitmm64
LastErrorCode                :
MaxMemorySupported           :
MaxNumberControlled          :
MaxRefreshRate               : 75
MinRefreshRate               : 56
Monochrome                   : False
Name                         : ATI Radeon HD 3300 Graphics
NumberOfColorPlanes          :
NumberOfVideoPages           :
PNPDeviceID                  : PCI\VEN_1002&DEV_9614&SUBSYS_00001002&REV_00\4&456635&0&2808
PowerManagementCapabilities  :
PowerManagementSupported     :
ProtocolSupported            :
ReservedSystemPaletteEntries :
SpecificationVersion         :
Status                       : OK
StatusInfo                   :
SystemCreationClassName      : Win32_ComputerSystem
SystemName                   : HUBING
SystemPaletteEntries         :
TimeOfLastReset              :
VideoArchitecture            : 5
VideoMemoryType              : 2
VideoMode                    :
VideoModeDescription         : 1024 x 768 x 4294967296 colors
VideoProcessor               : ATI Radeon HD 3300 Graphics (0x9614)

 
5.      查看计算机硬盘信息
在检查硬件信息的最后,我们来看看计算机的硬盘信息。
PS C:\> Get-WmiObject -Class Win32_DiskDrive
Partitions : 4
DeviceID   : \\.\PHYSICALDRIVE0
Model      : WDC WD6401AALS-00L3B2 ATA Device
Size       : 640132416000
Caption    : WDC WD6401AALS-00L3B2 ATA Device

 
Partitions代码分区的数量,Size表示磁盘的容量,一块小硬盘,嘿嘿。

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8183550/viewspace-691289/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8183550/viewspace-691289/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值