Games: Beginner 2

In this one we need to use WMI to get some information about the Processor in our machine.  Main difficulty is finding which class. In PowerShell v2 I can get away with this

Get-WmiObject -List "*processor*"

whereas in v1 I need to use

Get-WmiObject -List | where{$_.Name -like "*processor*"}

In either case the Win32_Processor class looks to be the best choice.   This leads to

001
002
003
004
005
006
007
$machine = Get-WmiObject -Class Win32_Processor
"Speed"
$machine | Format-List MaxClockSpeed, L2CacheSize, L2CacheSpeed, L3CacheSize, L3CacheSpeed
"Strength"
$machine | Format-List NumberOfCores, NumberOfLogicalProcessors
"Agility"
$machine | Format-List AddressWidth

 

Get the WMI information once and then select the bits we want to meet the criteria

Get-WmiObject -Class Win32_Processor | Get-Member

will give a full list of the properties.

If you want to colour the output use write-host and pick off the properties individually

Technorati Tags: ,

Leave a Reply