hey all, I just wrote the below script to do this, although here's a one-liner as well:
PS C:\temp> gwmi Win32_Processor | Format-table SystemName,Name,NumberOfCores -auto
SystemName Name NumberOfCores
---------- --- -------
Server-01 Intel(R) Xeon(R)CPU X5460 @ 3.16GHz 4
Server-01 Intel(R) Xeon(R)CPU X5460 @ 3.16GHz 4
Script
=================================================
$strComputer = (hostname)
$OF = "C:\temp\CPUAudit.txt"
$Arr = @()
Write-Host Begin Processor Survey -ForegroundColor Yellow
Foreach ($Server in $strComputer) {
$Counter = 0
Write-Host Querying Processor information on $Server -ForegroundColor Magenta
$colItems = get-wmiobject -class Win32_Processor -computername $Server
foreach($objItem in $colItems){
$temp = New-Object system.Object
$temp | Add-Member -MemberType NoteProperty -Name "MachineName" -Value $objItem.SystemName
$temp | Add-Member -MemberType NoteProperty -Name "Description" -Value $objItem.Caption
$temp | Add-Member -MemberType NoteProperty -Name "CPU #" -Value $objItem.Name
$temp | Add-Member -MemberType NoteProperty -Name "# Cores" -Value $objItem.NumberOfCores
$Arr += $temp
$Counter++
}
Write-Host Query returned $Counter Procs on $Server
Write-Host =================
}
Write-host Processed $Arr.count Servers -ForegroundColor Green
$Arr | FT -autosize | Out-File $OF -Append
> On Monday, April 14, 2008 10:30 PM joe wrote:
> How do I print out only the SystemName from Win32_Processor or
> Win32_computerSystem
>> On Tuesday, April 15, 2008 3:17 AM Pegasus \(MVP\) wrote:
>> "joe" <
j...@abc.com> wrote in message
>> news:OIKykCqn...@TK2MSFTNGP02.phx.gbl...
>>
>> Try this:
>> Set objCompSet =
>> GetObject("winmgmts:{impersonationLevel=impersonate}!//./root/cimv2").ExecQuery("select
>> Name from Win32_ComputerSystem")
>> For Each objDetail In objCompSet
>> WScript.echo objDetail.Name
>> Next
>>> On Wednesday, April 16, 2008 1:28 AM joe wrote:
>>> Hi
>>>
>>> What about the "system name" variable
>>>
>>> I want to output
>>>
>>> System Name
>>>
>>> hostname
>>>
>>> under one column in excel
>>>> On Wednesday, April 16, 2008 10:28 AM Pegasus \(MVP\) wrote:
>>>> I am not aware of a "System Name" variable. Where does
>>>> it occur?
>>>>> On Wednesday, April 16, 2008 10:52 PM joe wrote:
>>>>> when i run
>>>>>
>>>>> For Each objProperty In objClass.Properties_
>>>>> objSheet.Cells (intRow, intColumn) = objProperty.Name
>>>>> intColumn = intColumn + 1
>>>>> Next
>>>>>
>>>>>
>>>>> There is a column called System Name
>>>>>
>>>>> I want to output only this
>>>>> "Pegasus (MVP)" <I....@fly.com.oz> wrote in message
>>>>> news:ewBje48n...@TK2MSFTNGP05.phx.gbl...
>>>>>> On Thursday, April 17, 2008 4:33 AM Pegasus \(MVP\) wrote:
>>>>>> Can't tell - you are not giving us any definition of the object
>>>>>> objClass.Properties_.
>>>>>>> On Thursday, April 17, 2008 11:00 PM joe wrote:
>>>>>>> Set colItems = objWMIService.ExecQuery _
>>>>>>> ("Select * from Win32_Processor")