function Get-ProcessorInventory { <# .SYNOPSIS Get information about the CPU(s) .LINK Get-MachineInventory #> [CmdletBinding()] [OutputType([System.Collections.Specialized.OrderedDictionary])] Param() $logLead = Get-LogLeadName $providerStopWatch = [System.Diagnostics.StopWatch]::StartNew() $cpuDictionary = New-Object System.Collections.Specialized.OrderedDictionary $cpuDetails = New-Object System.Collections.Specialized.OrderedDictionary $cpuIndex = 0 $totalCoreCount = 0 try { Write-Host "$logLead : [$($providerStopWatch.Elapsed)] : Getting Processor Details" $processors = Get-CIMInstance -Namespace "root\CIMV2" -Class Win32_Processor ` -Property Manufacturer, Family, Revision, NumberOfLogicalProcessors, Description, MaxClockSpeed Write-Host "$logLead : [$($providerStopWatch.Elapsed)] : Processor Details Retrieved" foreach ($processor in $processors) { $indexId = Test-IsNull $processor.DeviceId ([string]$cpuIndex) -Strict $coreCount = $processor.NumberOfCores $totalCoreCount += $coreCount $cpuDetails[$indexId] = New-Object System.Collections.Specialized.OrderedDictionary $cpuDetails[$indexId]["Manufacturer"] = $processor.Manufacturer $cpuDetails[$indexId]["Family"] = [string]$processor.Family $cpuDetails[$indexId]["Revision"] = [string]$processor.Revision $cpuDetails[$indexId]["CoreCount"] = $coreCount $cpuDetails[$indexId]["LogicalCores"] = $processor.NumberOfLogicalProcessors $cpuDetails[$indexId]["Description"] = $processor.Description $cpuDetails[$indexId]["ClockSpeed"] = [string]$processor.MaxClockSpeed $cpuIndex += 1 Write-Host "$logLead : [$($providerStopWatch.Elapsed)] : $indexId Iteration Complete" } $cpuDetails["Sockets"] = $cpuIndex $cpuDetails["PhysicalCores"] = Test-IsNull $totalCoreCount $null -Strict } catch { $cpuDetails["Error"] = $_.Exception.ToString() } $cpuDictionary.Add("Processor" , $cpuDetails) Write-Host "$logLead : [$($providerStopWatch.Elapsed)] : Provider Complete" $providerStopWatch.Stop() return $cpuDictionary }