Hi All,
Thanks in advance ..!
how to check if a particular virtual machines that need disk consolidation.
The below command I am using is showing entire VM list in VC Get-VM
|
Where-Object
{
$_
.Extensiondata.Runtime.ConsolidationNeeded}
also let me know how to consolidate the set of VMs which is provided as an input from txt file.
Get-VM |
Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} |
ForEach-Object {
$_.ExtensionData.ConsolidateVMDisks()
}
Are you saying that
Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}
also shows you VMs that do not need consolidation?
If the vmnames come from a .txt file, you could do
Get-VM -Name (Get-Content -Path vmnames.txt) | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} | %{
$_.ExtensionData.ConsolidateVMDisks()
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your reply..!
Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}
When I connect to vCenter and run this command it is showing all the VMs which required disk consolidation.
I am looking for a command where I need to check the a particular VM required disk consolidation.
That's what the 2nd code in my previous reply is doing.
The .txt file contains the vm names, one per line, that you want to check.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your prompt reply..!
To check whether consolidation required I am using below command
Get-VM -Name (Get-Content -Path d:\vmnames.txt) | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded}
in vmnames.txt file I added two VMs names
VMtest1
VMtest2
But the not getting any result
when checking from GIU I can able to see consolidation tab enabled.
Let's analyse step by step.
Does this return all the lines you placed in the .txt file?
Get-Content -Path d:\vmnames.txt
Does this return an object for each VM name you placed in the .txt file?
Get-VM -Name (Get-Content -Path d:\vmnames.txt)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference