ITguy565
asked on
Powershell Hypervisor WMI script to pull Available Processor Cores and Compare to Host HyperVisor Total Cores
I am looking to pull a list of the following :
In my Code Everything works except for
- #Total Count of Physical CPU Cores
- #Total Count of In use CPU Cores
- #Total Count of Available CPU Cores
In my Code Everything works except for
#Total Count of Physical CPU Cores
#Total Count of In use CPU Cores
#Total COunt of Available CPU Cores
$cred = Get-Credential
$serverList = Get-ADComputer -Filter "Name -like '*SERVER*'" |Sort-Object -Property Name |Select-Object -ExpandProperty Name
$HyperVFailoverInfo = Invoke-Command -ComputerName $serverList -Credential $cred -ScriptBlock {
$vMList = Get-VM
$win32ProcessorList = Get-WmiObject -Class Win32_Processor
$TotalCPUCoresInUse = ($vMList | Where-Object {$_.State -eq 'Running'} | Get-VMProcessor | Measure-Object -Property Count -Sum).Sum
$logicalCpuCount = (($win32ProcessorList | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum)
$TotalAvailableCores = [Math]::Round(($logicalCpuCount.count - $TotalCPUCoresInUse), 2)
@{n = 'Total Processors'; e = {$logicalCpuCount}},
@{n = 'TotalVirtualCPUsInUse'; e = {$TotalCPUCoresInUse}},
@{n = 'Total Processors Available'; e = {$TotalAvailableCores}}
} |
Select-Object -Property * -ExcludeProperty PSComputerName, RunspaceId |
Sort-Object -Property ComputerName, VMName
$HyperVFailoverInfo | Out-GridView
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Yet again oBdA
ASKER
Excellent Assistance!
Sorry, leftover from testing: line 11 ("$TotalAvailableCores = ...") isn't doing anything useful anymore and can be deleted.
ASKER