Hi Team,
I am running below command :
Get-Folder Test | Get-VM
I got output with Powerstate,Num Cpus and Memory
How to add condition to check if both of VM having same count of cpu and memory
I want a output to mention same count of cpu and memory and if not, need mention whether cpu is not match or memory
Your request is a bit confusing (for me at least).
What exactly do you want to see in the output?
Perhaps show a mockup?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
When running below command:
Get-Folder Test | Get-VM
I got output as per attached with CPU count and Memory size.
Screen shot attached.
I would like to add a Comparison, if the vm in the folder list having same cpu and memory size or not.
And extract it as a report, so i can know which folder having vm resource mismatch
I know what Get-VM produces as output, my question is about the "... extract it as a report"
What do you envisage seeing in such a report?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
To identify and count how many VM in the folder having different cpu and memory.
Later will assign all vm in the folder with same cpu and memory
You mean like this?
Get-Folder -Name Test | Get-VM |
Group-Object -Property NumCPu, MemoryGB |
ForEach-Object -Process {
New-Object -TypeName PSObject -Property ([ordered]@{
NumCPu =[int]($_.Name.Split(',')[0])
MemoryGB = [int]($_.Name.Split(',')[1])
Count = $_.Group.Count
VM = $_.Group.Name -join '|'
})
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference